Skip to content
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

p2p: track goroutines with wg, fixes #20558 #20559

Closed
wants to merge 1 commit into from

Conversation

holiman
Copy link
Contributor

@holiman holiman commented Jan 15, 2020

Should fix #20558

@holiman holiman requested a review from fjl January 15, 2020 08:09
@holiman holiman requested a review from zsfelfoldi as a code owner January 15, 2020 08:09
p2p/server.go Outdated
@@ -911,7 +911,9 @@ func (srv *Server) listenLoop() {
fd = newMeteredConn(fd, true, addr)
srv.log.Trace("Accepted connection", "addr", fd.RemoteAddr())
}
srv.loopWG.Add(1)
Copy link
Contributor

@fjl fjl Jan 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding to loopWG from within the loop is unsafe because it can lead to Add being called concurrently with Wait. It would be better to wait for the slots channel on shutdown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've squashed in an alternate solution, PTAL

@fjl
Copy link
Contributor

fjl commented Jan 16, 2020

Resubmitted as #20569 with the additional change of waiting for all slots instead of just one.

@fjl fjl closed this Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Travis failure (internal/log)
2 participants