p2p: resolved deadlock on p2p server shutdown#2183
Merged
MatusKysel merged 2 commits intodevelopfrom Jan 26, 2024
Merged
Conversation
zzzckck
reviewed
Jan 26, 2024
Collaborator
|
Could you also post the deadlock callstack? |
galaio
reviewed
Jan 26, 2024
| close(srv.quit) | ||
| srv.lock.Unlock() | ||
|
|
||
| stopChan := make(chan struct{}) |
Contributor
There was a problem hiding this comment.
The previous code tries to skip srv.loopWG.Wait() if stopTimeout reach, maybe this is to solve issues before?
Is it ok just remove above case <-cs.handler.stopCh:, and keep this logic unchanged?
Contributor
Author
There was a problem hiding this comment.
Maybe it's ok but I removed because:
- this is hiding potential deadlock in the future
- there is no right timeout value, it was 5s but for graceful shutdown of node with 2k connection is much more
I am ok with returning it but increasing timeout to like 30s or something, but still, geth has nothing like that in their code and they just wait
f08eda2 to
f0d9f61
Compare
zzzckck
approved these changes
Jan 26, 2024
galaio
approved these changes
Jan 26, 2024
This was referenced Feb 18, 2024
Merged
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.
Description
This PR removes forceful stop of p2p server that was caused by deadlock on channels. In
protoTracker()we should be waiting for signals from allhandlerDoneCh, but with return onstopChwe returned and protocol handler got stuck on sending signal tohandlerDoneCh. This changes removes this deadlock and also part of the code from p2p server that forcefully killed the server.