testcontainers / testcontainers/testcontainers-python
Bug: Random failures on Redis Container when DinD + parallel
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 2.3k
- 派生
- 386
- 平均合并
- 4 小时 40 分钟
- 30 天内合并 PR
- 1
描述
Describe the bug
Hey everyone,
I have a monorepo with dozens of small projects, and I am running tests that use a Redis Container in each project.
To reduce the time to run the tests (since each project tests are somewhat CPU-light), I am using gnu parallel
to run the tests of all projects in parallel, this causes situations where several containers are appearing/terminating
simultaneously. I do not have any problems running this setup locally.
However, in my CI pipeline, each is built on top of a k8s cluster that uses dind to run the containers inside the container of the CI runner, the tests are incredibly flaky, even with multiple retries. The error is always something like this:
def read_response(self, disable_decoding=False):
if not self._reader:
raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
# _next_response might be cached from a can_read() call
if self._next_response is not False:
response = self._next_response
self._next_response = False
return response
if disable_decoding:
response = self._reader.gets(False)
else:
response = self._reader.gets()
while response is False:
self.read_from_socket()
if disable_decoding:
response = self._reader.gets(False)
else:
> response = self._reader.gets()
E redis.exceptions.InvalidResponse: Protocol error, got "A" as reply type byte
I am not sure if this is an issue with testcontainers, but I already spent several hours trying to find the problem.
Do you guys know what might be the source of this issue?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
未指定仓库文件或测试。首先使用 GNU parallel 和多个 Redis 容器复现 DinD 与 Kubernetes 设置,然后结合 read_response 中显示的 Redis 客户端错误检查容器生命周期。完成标准是确定故障发生在 testcontainers 中还是 CI/容器设置中,并记录可复现的解决方案。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- docker, kubernetes, python, redis
- 领域
- databases, infrastructure, testing
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100