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

server: fix race between GracefulStop and new incoming connections (#1745) #1745

Merged
merged 2 commits into from
Dec 18, 2017

Conversation

dfawley
Copy link
Member

@dfawley dfawley commented Dec 15, 2017

Fixes #1737
Updates #1738

@dfawley
Copy link
Member Author

dfawley commented Dec 15, 2017

"context" was imported by goimports instead of "x/net/context" in the new test file. Fixed and push -f'd

}()

fmt.Println("calling RPC")
time.Sleep(time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we sleep here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Accidental leftover from debugging. Also removed lots of fmt.Prints

server.go Outdated
@@ -511,7 +516,8 @@ func (s *Server) Serve(lis net.Listener) error {
timer := time.NewTimer(tempDelay)
select {
case <-timer.C:
case <-s.ctx.Done():
case <-s.quit:
return nil
}
timer.Stop()
Copy link
Contributor

Choose a reason for hiding this comment

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

Not in your PR but we can get rid of this time.Stop() now that we're here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to the appropriate place.

server.go Outdated
if !s.addConn(conn) {
conn.Close()
return
}
defer s.removeConn(conn)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be deleted too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, thanks - done.

@dfawley dfawley changed the title Fix race between GracefulStop and new incoming connections server: fix race between GracefulStop and new incoming connections (#1745) Dec 18, 2017
@dfawley dfawley merged commit 2720857 into grpc:master Dec 18, 2017
@dfawley dfawley deleted the graceful_stop2 branch December 19, 2017 18:28
@dfawley dfawley added this to the 1.9 Milestone milestone Jan 2, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants