Skip to content

staticaddr: fix crash in loop-in manager shutdown #942

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions staticaddr/loopin/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,25 @@ func (m *Manager) Run(ctx context.Context) error {
case request.respChan <- resp:

case <-ctx.Done():
// Noify subroutines that the main loop has been
// canceled.
// Notify subroutines that the main loop has
// been canceled.
close(m.exitChan)

return ctx.Err()
}

case sweepReq := <-sweepReqs:
case sweepReq, ok := <-sweepReqs:
if !ok {
// The channel has been closed, we'll stop the
// loop-in manager.
log.Debugf("Stopping loop-in manager " +
"(ntfnChan closed)")

close(m.exitChan)

return fmt.Errorf("ntfnChan closed")
}

err = m.handleLoopInSweepReq(ctx, sweepReq)
if err != nil {
log.Errorf("Error handling loop-in sweep "+
Expand Down