testcontainers / testcontainers/testcontainers-python

Bug: Random failures on Redis Container when DinD + parallel

Abierto
#511 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
Python
Estrellas
2.3k
Forks
386
Merge medio
4 h 40 min
PR fusionados (30 d)
1

Descripción

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?

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

No se indica ningún archivo del repositorio ni ninguna prueba. Empieza reproduciendo la configuración de DinD y Kubernetes con GNU parallel y varios contenedores de Redis, y después inspecciona el ciclo de vida de los contenedores junto con el error del cliente Redis mostrado en read_response. Se considerará terminado cuando se identifique si el fallo está en testcontainers o en la configuración de CI/contenedores y se documente una resolución reproducible.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
docker, kubernetes, python, redis
Área
databases, infrastructure, testing
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.