networking: don't permanently drop discovery addresses on transient EHOSTUNREACH#2192
Open
batmunkh0612 wants to merge 1 commit into
Open
Conversation
…HOSTUNREACH On macOS, send_to on the discovery socket can return EHOSTUNREACH transiently (observed right after boot, wake, or link changes on Mac mini M4 / macOS 26). The announce loop treated this as permanent and swap_remove'd the interface, so within a couple of ticks the announce list drained to empty and peer discovery went silent — every node elected itself Master and clusters never formed. Interfaces that actually disappear are already pruned by the netwatcher callback via update.diff.removed, so removing them from the announce path is redundant; treat the error as transient and keep announcing.
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 #2191
Problem
Discovery::announce()treatsEHOSTUNREACHfromsend_toas permanent andswap_removes the address from the announce list. On macOS this errno occurs transiently (right after boot, wake, or link changes) on all interfaces at once — so within ~2 ticks the announce list drains to empty and peer discovery goes permanently silent. Nodes then only ever discover themselves and each elects itself Master. Details, instrumented timeline, and wire captures in #2191.Change
Treat
EHOSTUNREACHas transient: log atdebug!and keep the address. Permanent interface removal is already handled by thenetwatchercallback viaupdate.diff.removed, so the announce path doesn't need to prune.Testing
cargo check -p networkingclean.main@b5375f8c: before the change, an instrumented build shows tick 1 sends OK, tick 2 getsEHOSTUNREACHon all 7 interfaces, announce list drains to[], andtcpdump -ni en0 udp port 52413shows no beacons. With the change, Hello beacons egressen0steadily (1/s) and sends succeed on subsequent ticks (11/11 over a 14 s window on the same machine).