-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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 should send 2 goaway messages to gracefully shutdown the connection. #1403
Conversation
transport/http2_server.go
Outdated
@@ -631,7 +638,7 @@ func (t *http2Server) handlePing(f *http2.PingFrame) { | |||
|
|||
if t.pingStrikes > maxPingStrikes { | |||
// Send goaway and close the connection. | |||
t.controlBuf.put(&goAway{code: http2.ErrCodeEnhanceYourCalm, debugData: []byte("too_many_pings")}) | |||
t.drain(http2.ErrCodeEnhanceYourCalm, []byte("too_many_pings"), true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert but add closeConn:true to the goAway.
transport/http2_server.go
Outdated
@@ -592,6 +595,10 @@ const ( | |||
|
|||
func (t *http2Server) handlePing(f *http2.PingFrame) { | |||
if f.IsAck() { | |||
if f.Data == goAwayPing.data { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&& t.drainChan != nil
transport/http2_server.go
Outdated
t.drain(http2.ErrCodeNo, []byte{}, false) | ||
} | ||
|
||
func (t *http2Server) drain(code http2.ErrCode, debugData []byte, closeConn bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove closeConn
transport/http2_server.go
Outdated
t.framer.writePing(true, false, goAwayPing.data) | ||
go func() { | ||
timer := time.NewTimer(time.Minute) | ||
defer func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defer timer.Stop()
transport/http2_server.go
Outdated
@@ -1032,13 +1036,48 @@ func (t *http2Server) controller() { | |||
// The transport is closing. | |||
return | |||
} | |||
ch := t.drainChan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove local var
transport/http2_server.go
Outdated
sid := t.maxStreamID | ||
t.state = draining | ||
if i.isSecond { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isSecond -> isFirst and reorganize?
transport/http2_server.go
Outdated
select { | ||
case <-ch: | ||
case <-timer.C: | ||
timer.Reset(infinity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary Reset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one comment typo nit.
transport/http2_server.go
Outdated
if i.code == http2.ErrCodeEnhanceYourCalm { | ||
t.Close() | ||
if !i.headsUp { | ||
// Stop accepting more stream now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stream_s_
Thanks @MakMukhi ! Please drop us a note when you release this. |
Server should send 2 goaway messages to gracefully shutdown the connection. (grpc#1403) * First commit. * Basic implementation * Server should send two GoAways to gracefully shutdown the connection. * mend * Post-review updates * Fixed issue after rebase * Fixing typo Add balancer, resolver and connectivity package. add balancer_v1_wrapper.go and remove grpclb.go all test passed, how? end2end passed, nil pointer failure, ac.wait return nil transport fix ac.wait return nil transport, races not fixed (accessing cc.balancer) end2end passed, TODO grpclb all test passed add grpclb back move building balancer out from a goroutine to avoid race Otherwise, Dial() and Close() may race. Mark new APIs experimental split resetAddrConn into newAddrConn and connect add acBalancerWrapper rename file to balancer_conn_wrappers.go remove grpclog.Print make TODO(bar) remove Print comments fixes add missing license fix build failure after merge fix race in grpclb Update comments for balancer and resolver, and rename SubConnection to SubConn Add balancer, resolver and connectivity package. all test passed, how?
…ction. (#1403) * First commit. * Basic implementation * Server should send two GoAways to gracefully shutdown the connection. * mend * Post-review updates * Fixed issue after rebase * Fixing typo
@gitsen This was released in v1.5.2. |
Thanks @menghanl we will update and report our findings here |
Server should send 2 goaway messages to gracefully shutdown the connection. (grpc#1403) * First commit. * Basic implementation * Server should send two GoAways to gracefully shutdown the connection. * mend * Post-review updates * Fixed issue after rebase * Fixing typo Add balancer, resolver and connectivity package. add balancer_v1_wrapper.go and remove grpclb.go all test passed, how? end2end passed, nil pointer failure, ac.wait return nil transport fix ac.wait return nil transport, races not fixed (accessing cc.balancer) end2end passed, TODO grpclb all test passed add grpclb back move building balancer out from a goroutine to avoid race Otherwise, Dial() and Close() may race. Mark new APIs experimental split resetAddrConn into newAddrConn and connect add acBalancerWrapper rename file to balancer_conn_wrappers.go remove grpclog.Print make TODO(bar) remove Print comments fixes add missing license fix build failure after merge fix race in grpclb Update comments for balancer and resolver, and rename SubConnection to SubConn Add balancer, resolver and connectivity package. all test passed, how?
Server should send 2 goaway messages to gracefully shutdown the connection. (grpc#1403) * First commit. * Basic implementation * Server should send two GoAways to gracefully shutdown the connection. * mend * Post-review updates * Fixed issue after rebase * Fixing typo Add balancer, resolver and connectivity package. add balancer_v1_wrapper.go and remove grpclb.go all test passed, how? end2end passed, nil pointer failure, ac.wait return nil transport fix ac.wait return nil transport, races not fixed (accessing cc.balancer) end2end passed, TODO grpclb all test passed add grpclb back move building balancer out from a goroutine to avoid race Otherwise, Dial() and Close() may race. Mark new APIs experimental split resetAddrConn into newAddrConn and connect add acBalancerWrapper rename file to balancer_conn_wrappers.go remove grpclog.Print make TODO(bar) remove Print comments fixes add missing license fix build failure after merge fix race in grpclb Update comments for balancer and resolver, and rename SubConnection to SubConn Add balancer, resolver and connectivity package. all test passed, how?
Server should send 2 goaway messages to gracefully shutdown the connection. (grpc#1403) * First commit. * Basic implementation * Server should send two GoAways to gracefully shutdown the connection. * mend * Post-review updates * Fixed issue after rebase * Fixing typo Add balancer, resolver and connectivity package. add balancer_v1_wrapper.go and remove grpclb.go all test passed, how? end2end passed, nil pointer failure, ac.wait return nil transport fix ac.wait return nil transport, races not fixed (accessing cc.balancer) end2end passed, TODO grpclb all test passed add grpclb back move building balancer out from a goroutine to avoid race Otherwise, Dial() and Close() may race. Mark new APIs experimental split resetAddrConn into newAddrConn and connect add acBalancerWrapper rename file to balancer_conn_wrappers.go remove grpclog.Print make TODO(bar) remove Print comments fixes add missing license fix build failure after merge fix race in grpclb Update comments for balancer and resolver, and rename SubConnection to SubConn Add balancer, resolver and connectivity package. all test passed, how?
Fixes #1387