testcontainers / testcontainers/testcontainers-python

Bug: Random failures on Redis Container when DinD + parallel

Aperta
#511 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Python
Stelle
2.3k
Fork
386
Merge medio
4h 40m
PR unite (30g)
1

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Non sono indicati file del repository né test. Inizia riproducendo la configurazione DinD e Kubernetes con GNU parallel e più container Redis, quindi analizza il ciclo di vita dei container insieme all'errore del client Redis mostrato in read_response. Il lavoro è completato quando viene identificato se il problema si trova in testcontainers o nella configurazione CI/dei container e viene documentata una risoluzione riproducibile.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
docker, kubernetes, python, redis
Ambito
databases, infrastructure, testing
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.