Floor `get_rando_addr` port at 1024, not 1000
Ports below 1024 are privileged on linux (`net.ipv4.ip_unprivileged_port_start = 1024`), so a non-root `.bind()` on one raises `PermissionError`. The old `1000 +` floor could roll into the 1000-1023 range and trip flaky `[Errno 13] Permission denied` registry-listener binds; bump the base to 1024 so every generated port is non-privileged. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code
parent
5d017fe3d0
commit
0fad0a3c0f
|
|
@ -72,7 +72,12 @@ def get_rando_addr(
|
||||||
# `test_tpt_bind_addrs::bind-subset-reg`),
|
# `test_tpt_bind_addrs::bind-subset-reg`),
|
||||||
# - across parallel pytest sessions, the pid bias
|
# - across parallel pytest sessions, the pid bias
|
||||||
# makes coincident port choices unlikely.
|
# makes coincident port choices unlikely.
|
||||||
port: int = 1000 + (
|
# NB. floor at 1024, NOT 1000: ports <1024 are PRIVILEGED
|
||||||
|
# on linux (`net.ipv4.ip_unprivileged_port_start = 1024`),
|
||||||
|
# so a non-root `.bind()` on one raises `PermissionError`.
|
||||||
|
# The old `1000 +` floor could roll 1000-1023 -> flaky
|
||||||
|
# `[Errno 13] Permission denied` registry-listener binds.
|
||||||
|
port: int = 1024 + (
|
||||||
random.randint(0, 8999) + os.getpid()
|
random.randint(0, 8999) + os.getpid()
|
||||||
) % 9000
|
) % 9000
|
||||||
testrun_reg_addr = (
|
testrun_reg_addr = (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue