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 should send 2 goaway messages to gracefully shutdown the connection. #1403

Merged
merged 7 commits into from
Aug 9, 2017

Conversation

MakMukhi
Copy link
Contributor

@MakMukhi MakMukhi commented Jul 28, 2017

Fixes #1387

@MakMukhi MakMukhi requested review from dfawley and menghanl July 28, 2017 22:33
@@ -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)
Copy link
Member

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.

@@ -592,6 +595,10 @@ const (

func (t *http2Server) handlePing(f *http2.PingFrame) {
if f.IsAck() {
if f.Data == goAwayPing.data {
Copy link
Member

Choose a reason for hiding this comment

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

&& t.drainChan != nil

t.drain(http2.ErrCodeNo, []byte{}, false)
}

func (t *http2Server) drain(code http2.ErrCode, debugData []byte, closeConn bool) {
Copy link
Member

Choose a reason for hiding this comment

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

Remove closeConn

t.framer.writePing(true, false, goAwayPing.data)
go func() {
timer := time.NewTimer(time.Minute)
defer func() {
Copy link
Member

Choose a reason for hiding this comment

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

defer timer.Stop()

@@ -1032,13 +1036,48 @@ func (t *http2Server) controller() {
// The transport is closing.
return
}
ch := t.drainChan
Copy link
Member

Choose a reason for hiding this comment

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

Remove local var

sid := t.maxStreamID
t.state = draining
if i.isSecond {
Copy link
Member

Choose a reason for hiding this comment

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

isSecond -> isFirst and reorganize?

select {
case <-ch:
case <-timer.C:
timer.Reset(infinity)
Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary Reset.

@dfawley dfawley self-assigned this Aug 4, 2017
Copy link
Member

@dfawley dfawley left a 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.

if i.code == http2.ErrCodeEnhanceYourCalm {
t.Close()
if !i.headsUp {
// Stop accepting more stream now.
Copy link
Member

Choose a reason for hiding this comment

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

stream_s_

@dfawley dfawley assigned MakMukhi and unassigned dfawley Aug 7, 2017
@MakMukhi MakMukhi merged commit 7657092 into grpc:master Aug 9, 2017
@gitsen
Copy link

gitsen commented Aug 9, 2017

Thanks @MakMukhi ! Please drop us a note when you release this.

menghanl pushed a commit to menghanl/grpc-go that referenced this pull request Aug 11, 2017
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?
menghanl pushed a commit that referenced this pull request Aug 14, 2017
…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
@menghanl
Copy link
Contributor

@gitsen This was released in v1.5.2.

@gitsen
Copy link

gitsen commented Aug 14, 2017

Thanks @menghanl we will update and report our findings here

menghanl pushed a commit to menghanl/grpc-go that referenced this pull request Aug 15, 2017
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?
menghanl pushed a commit to menghanl/grpc-go that referenced this pull request Aug 16, 2017
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?
menghanl pushed a commit to menghanl/grpc-go that referenced this pull request Aug 24, 2017
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?
@dfawley dfawley modified the milestone: 1.6 Release Aug 28, 2017
@MakMukhi MakMukhi deleted the goaway_server branch May 4, 2018 02:04
@lock lock bot locked as resolved and limited conversation to collaborators Oct 31, 2018
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.

4 participants