Client-side host port pick collides with ports already in use
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 20/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- PHP
- Étoiles
- 216
- Forks
- 38
- Merge moyen
- 1 j 14 h
- PR mergées (30 j)
- 5
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Aucun guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de testcontainers/testcontainers-php
-
Difficulté 2/5 1-3 heures Accessibilité débutants 45/100
testcontainers/testcontainers-php#83 · 3 commentaires ·
-
Difficulté 4/5 3-5 jours Accessibilité débutants 38/100
testcontainers/testcontainers-php#57 · 1 réaction ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 55/100
-
WaitForLog timeout too shortOuverte
Difficulté 2/5 1-3 heures Accessibilité débutants 45/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 48/100
Toutes les issues de testcontainers/testcontainers-php
Issues similaires
-
15.0
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
-
bug needs-triage
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
camunda/orchestration-cluster-api-php#162 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Procedure for security issuesOuverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 65/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
TYPO3-Solr/ext-solr#4850 ·
Les mainteneurs répondent en général sous 2 jours
-
Hex viewer drops ASCII '0' after a complete rowPeut-être pris @palashranka l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 3 jours