fix(runtime): an ephemeral listen_port must derive ephemeral ports (#52) - #53
Merged
Conversation
`listen_port = 0` means "bind an ephemeral port", so it is not a base to add an offset to. The helpers added theirs unconditionally and produced ports 1 (metrics), 2 (dashboard), 500 (Raft) and 600 (gossip) — all privileged, all refused on Linux without CAP_NET_BIND_SERVICE. `Runtime: boot 2 shards and shutdown` uses `.listen_port = 0`, and both metrics_enabled and dashboard_enabled default to true, so it tried to bind port 2 and failed. The metrics exporter hit it first but survived — it got graceful bind-failure logging in #43; the dashboard has no such guard and failed the whole runtime start. An unresolved base now derives an unresolved port: the helpers return 0 when listen_port is 0. An explicitly configured port still wins. macOS permits bind(0.0.0.0, <low port>) where Linux does not, which is why every local run passed. Second Linux-only failure found by the CI in #49, after #50. Also updates the ephemeral-port test added in #47, which asserted effectiveRaftPort() == 500 — that pinned the buggy behaviour.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #52. Second Linux-only failure found by the CI in #49.
The bug
listen_port = 0means "bind an ephemeral port" — it isn't a base you can add an offset to. The helpers added theirs anyway:listen_port = 0All privileged; all refused on Linux without
CAP_NET_BIND_SERVICE.Runtime: boot 2 shards and shutdownuses.listen_port = 0, andmetrics_enabled/dashboard_enabledboth default totrue, so it tried to bind port 2:The metrics exporter hits it first but survives — it got graceful bind-failure logging in #43. The dashboard has no such guard, so the whole runtime start fails.
Why every local run passed
macOS permits
bind(0.0.0.0, <low port>)where Linux does not. I checked directly rather than assuming:The fix
An unresolved base derives an unresolved port: the helpers return
0whenlisten_port == 0. An explicitly configured port still wins in every case.Also updates the ephemeral-port test I added in #47 — it asserted
effectiveRaftPort() == 500, which pinned the buggy behaviour. Worth calling out: that test passed while documenting a bug, which is exactly the failure mode I've been flagging elsewhere in this codebase.Sequence, for context
This is why the failure moved between CI runs rather than disappearing: #47's
clusterListenerWanted()gate stopped the Raft bind, so the next privileged bind in line — the dashboard — became the failure. Same root cause, three services deep.Verification
test-unit(1328 tests) andtest-integrationpass locally. Linux is covered by #49's CI once this lands.