Client-side host port pick collides with ports already in use
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 20/100
Direzione di ricerca
Start with GenericContainer's default host port binding and compare it with the daemon allocated port flow described in the issue. Check how getMappedPort() reads NetworkSettings.Ports, then verify that withPortGenerator() still supports fixed ports. Done means the default binding leaves HostPort unset and the mapped port is available after start; pull request #81 is already open for this change.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
GenericContainer picks host ports on its own: RandomUniquePortGenerator takes a random port from 10000–65535 and only checks that nothing accepts connections on localhost:<port>. The port can still be taken between that check and the container start, or be bound without a listener — for example as the local port of an outgoing connection, when the host's ephemeral range overlaps 10000–65535. The start then fails:
Docker\API\Exception\ContainerStartInternalServerErrorException: server error
rootlessport listen tcp 0.0.0.0:16544: bind: address already in use
We hit this a few times a week on a CI host that runs test suites in parallel (rootless Podman, net.ipv4.ip_local_port_range = 10000 65535).
Other Testcontainers implementations leave host port allocation to the daemon: the binding goes out without HostPort, and the mapped port is read from NetworkSettings.Ports after start. getMappedPort() already reads it from inspect, so only the default binding has to change, while withPortGenerator() keeps working for fixed ports.
I'll open a PR with this change.
- Lingua principale
- PHP
- Stelle
- 216
- Fork
- 38
- Merge medio
- 1g 14h
- PR unite (30g)
- 5
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di testcontainers/testcontainers-php
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
testcontainers/testcontainers-php#83 · 3 commenti ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
testcontainers/testcontainers-php#57 · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
-
WaitForLog timeout too shortAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
Tutte le issue di testcontainers/testcontainers-php
Issue simili
-
15.0
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
bug needs-triage
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
camunda/orchestration-cluster-api-php#162 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
TYPO3-Solr/ext-solr#4850 ·
I maintainer di solito rispondono entro 2 giorni
-
Hex viewer drops ASCII '0' after a complete rowForse già presa @palashranka l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 3 giorni