Repository navigation
fix(wgbridge): rebind UDP sockets to a fresh ephemeral port - #999
Merged
Merged
Conversation
gotatun 0.10 records the port it actually bound, so Tunnel::rebind() restored that concrete port and re-bound it while the old socket could still be held by tasks that were shutting down. This failed intermittently with EADDRINUSE, as in the instrumented test tunnelStatsRebindAndStopUseRealJni on master. End the toggle on port 0 instead so each rebind gets a fresh ephemeral port. Claude-Session: https://claude.ai/code/session_012jPc9ojxUPCR3f3hR4ycTP
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.
Why CI failed
The
instrumentationjob on master (run 39949143135) failed inWgbridgeInstrumentedTest.tunnelStatsRebindAndStopUseRealJni:The gotatun 0.9.2 → 0.10.1 bump (#989) changed
Connection::set_upto remember the port it actually bound (device.port = addr.port()).Tunnel::rebind()toggled the port and then restored the original value, which is now that concrete port, not 0. The new socket is bound to the same port while the old one may still be held by connection tasks that are shutting down, so the bind fails intermittently. The same PR's own run passed, so this is a race and not something #997 introduced.Change
rebind()now always ends on port 0, so each rebind gets a fresh ephemeral port. TrackerControl never configures a listen port, and WireGuard peers roam to the new source port on the next packet. This affects production roaming as well as the test.Testing
cargo testinwgbridge-rs: 71 passed.https://claude.ai/code/session_012jPc9ojxUPCR3f3hR4ycTP
Generated by Claude Code