From 3e04968e7900e29105f4e39cd2d5a86caafdb672 Mon Sep 17 00:00:00 2001 From: goodboy Date: Sat, 27 Jun 2026 18:54:06 -0400 Subject: [PATCH] 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 --- tractor/_testing/addr.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tractor/_testing/addr.py b/tractor/_testing/addr.py index 6927db77..db95889d 100644 --- a/tractor/_testing/addr.py +++ b/tractor/_testing/addr.py @@ -72,7 +72,12 @@ def get_rando_addr( # `test_tpt_bind_addrs::bind-subset-reg`), # - across parallel pytest sessions, the pid bias # 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() ) % 9000 testrun_reg_addr = (