Repository navigation
daemon: shutdown waits for a handshake poll in flight; follow-ups to #500 - #514
Merged
Merged
Conversation
…-ups to #500 From the second review of #500. - Shutdown closed the registry client without waiting for a poll in flight. The registry empties the node's handshake inbox as it answers, so a restart during a poll lost what it carried. doStop now waits up to 5s for the poll (waitIdle), and pollHandshakes starts none once the daemon is stopping. - At the 64-peer cap, only the closed-window peer whose rearm ends soonest is evicted; the others keep their hold-off against automatic handshakes reopening a window. - A beacon notify with bytes after the handshake kind is acted on, so a later beacon can extend the message without older daemons ignoring it. - Comments: the package doc describes the wait-for-trust condition, and pollRelayedHandshakes no longer documents the removed timeout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review fixes. - Shutdown waited for a poll in flight only after the handshake manager had stopped, so the poll's reply was processed by a stopped manager: requests and approvals were neither saved nor answered, and the registry had already emptied the inbox. The wait now comes before the manager stops. - No poll can start once shutdown has begun: the scheduler is closed under the same lock that starting a poll takes. Before, a caller past the stopping check could start one after the wait had returned. - The wait shares the 5s deadline shutdown already gives its background goroutines instead of adding 5s of its own. - The shutdown test now calls Stop and checks the order; tests cover the closed scheduler and which settled peer is let go. Each fails against the matching revert. - Changelog entries for the eviction and notify changes; the notify comments say v1.16.0 still requires exactly two bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TeoSlayer
force-pushed
the
fix/handshake-poll-followups
branch
from
October 7, 2026 14:08
14dbf88 to
eb67eba
Compare
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.
Follow-ups from the second independent review of #500 (merged in v1.16.0). All low severity; none changes the trust timings.
Changes
doStopclosed the registry client without waiting for a poll that was still running, so a restart during one dropped the requests and approvals it carried (the reviewer reproduced it with a 1 s reply and a stop 200 ms into the poll).doStopnow waits up to 5 s (waitIdle) before closing the client, andpollHandshakesstarts nothing once the daemon is stopping.pollRelayedHandshakesno longer documents the removed timeout.Tests
TestShutdownWaitsForThePollInFlight.TestSettledPeersDoNotCrowdOutANewRequest(only one entry is evicted) andTestBeaconNotifyOfUnknownKindIsDropped(trailing bytes after a known kind are accepted).go vetis clean. Thepkg/daemonunit suite passes, and the handshake-poll tests pass twice under-race.🤖 Generated with Claude Code