fix(daemon): register echo service listener with bgWG (PILOT-88)#406
Open
matthew-pilot wants to merge 1 commit into
Open
fix(daemon): register echo service listener with bgWG (PILOT-88)#406matthew-pilot wants to merge 1 commit into
matthew-pilot wants to merge 1 commit into
Conversation
The startEchoService goroutine was the last daemon-scoped goroutine not registered with d.bgWG. During graceful shutdown, the echo listener exited correctly (select on d.stopCh) but was unaccounted for in the WaitGroup — meaning bgWG.Wait() could return before the listener had fully stopped if it was racing with port teardown. This is a continuation of the mechanical sweep described in PILOT-88: the core loops (routeLoop, trustRepublishLoop, etc.) already used bgWG, but the echo service was missed. Adding d.bgWG.Add(1) / defer d.bgWG.Done() ensures the shutdown sequence waits for the echo listener to exit before tearing down port infrastructure. Closes PILOT-88
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.
What
The
startEchoServicegoroutine was the last daemon-scoped goroutine not registered withd.bgWG. During graceful shutdown, the echo listener exited correctly (select on d.stopCh) but was unaccounted for in the WaitGroup — meaningbgWG.Wait()could return before the listener had fully stopped if it was racing with port teardown.Why
This is a continuation of the mechanical sweep described in PILOT-88: the core loops (routeLoop, trustRepublishLoop, etc.) already used bgWG, but the echo service was missed. Adding
d.bgWG.Add(1)/defer d.bgWG.Done()ensures the shutdown sequence waits for the echo listener to exit before tearing down port infrastructure.Verification
go build ./pkg/daemon/— cleango vet ./pkg/daemon/— cleango test -count=1 ./pkg/daemon/— all tests pass (36.6s)Closes PILOT-88