Skip to content

Commit

Permalink
peer: eliminate circular waiting by calling maybeSendNodeAnn async
Browse files Browse the repository at this point in the history
In this commit, we attempt to fix circular waiting scenario introduced
inadvertently when [fixing a race condition
scenario](#7856). With that
PR, we added a new channel that would block `Disconnect`, and
`WaitForDisconnect` to ensure that only until the `Start` method has
finished would those calls be allowed to succeed.

The issue is that if the server is trying to disconnect a peer due to a
concurrent connection, but `Start` is blocked on `maybeSendNodeAnn`,
which then wants to grab the main server mutex, then `Start` can never
exit, which causes `startReady` to never be closed, which then causes
the server to be blocked.

This PR attempts to fix the issue by calling `maybeSendNodeAnn` in a
goroutine, so it can grab the server mutex and not block the `Start`
method.

Fixes #7924

Fixes #7928

Fixes #7866
  • Loading branch information
Roasbeef committed Aug 29, 2023
1 parent d24f12b commit 82bac90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion peer/brontide.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ func (p *Brontide) Start() error {
//
// TODO(wilmer): Remove this once we're able to query for node
// announcements through their timestamps.
p.maybeSendNodeAnn(activeChans)
go p.maybeSendNodeAnn(activeChans)

return nil
}
Expand Down

0 comments on commit 82bac90

Please sign in to comment.