containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.69k stars 2.41k forks source link

system tests: start_registry: pasta: Failed to bind port 4xxxx (Address already in use) #23862

Closed edsantiago closed 1 month ago

edsantiago commented 2 months ago

Weird one, seen only twice in 1 month:

[+0226s] not ok 133 [150] podman login - basic test in 2584ms
... running start_registry ....
<+2.13s> # $ podman --storage-driver vfs --root /tmp/CI_HpL4/bats-run-bGGd21/suite/podman-bats-registry/root --runroot /tmp/CI_HpL4/bats-run-bGGd21/suite/podman-bats-registry/runroot --tmpdir /tmp/CI_HpL4/bats-run-bGGd21/suite/podman-bats-registry/tmpdir run -d -p 127.0.0.1:42188:5000 --name registry -v /tmp/CI_HpL4/bats-run-bGGd21/suite/podman-bats-registry/auth:/auth:Z -e REGISTRY_AUTH=htpasswd -e REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd -e REGISTRY_HTTP_TLS_CERTIFICATE=/auth/domain.crt -e REGISTRY_HTTP_TLS_KEY=/auth/domain.key quay.io/libpod/registry:2.8.2
<+157ms> # Error: pasta failed with exit code 1:
         # Failed to bind port 42188 (Address already in use) for option '-t 127.0.0.1/42188-42188:5000-5000', exiting

Not a parallelization bug. I'm completely stumped.

x x x x x x
sys(2) podman(2) fedora-40(1) rootless(2) host(2) sqlite(1)
debian-13(1) boltdb(1)
Luap99 commented 2 months ago

Ports in the range in /proc/sys/net/ipv4/ip_local_port_range 32768-60999 will be used as ephemeral range so any process binding to port 0 or connect somewhere else (outgoing connection) can get ports from this range assigned. That races with our port is free logic as we check if it is free and then later use it, if another process got it between that we fail. That doesn't mean it is the cause here but I would recommend against using ports from this range to avoid such races.

edsantiago commented 1 month ago

Treating this one as closed by #24002