Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Random failures on Redis Container when DinD + parallel #511

Open
jmspereira opened this issue Mar 28, 2024 · 2 comments
Open

Bug: Random failures on Redis Container when DinD + parallel #511

jmspereira opened this issue Mar 28, 2024 · 2 comments

Comments

@jmspereira
Copy link

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?

@alexanderankin
Copy link
Collaborator

is running in dind a sufficient condition to cause this error or does it go away when you stop running in parallel and run single threaded?

@jmspereira
Copy link
Author

If I run all the tests sequentially, the problem does not exist. But again, I do not have this problem when running the tests with parallel in a local environment (without dind) :/

@alexanderankin alexanderankin changed the title Bug: Random failures on Redis Container Bug: Random failures on Redis Container when DinD + parallel Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants