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

transport: Fix closing a closed channel panic in handlePing #5854

Merged
merged 3 commits into from Dec 13, 2022

Conversation

zasweq
Copy link
Contributor

@zasweq zasweq commented Dec 9, 2022

Fixes #5786.

Two GoAway pings were previously closing a closed channel, this PR adds protection with respect to the drainChan closing (used as a signal to write second GoAway frame). We still to derive the underlying root cause as to why two goaway ping acks are being sent from the Swift client.

RELEASE NOTES:

  • transport: Fixed closing a closed channel panic in handlePing

@zasweq zasweq requested a review from dfawley December 9, 2022 20:50
@zasweq zasweq added this to the 1.52 Release milestone Dec 9, 2022
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.

LGTM modulo a couple nits. And also go/cl-descriptions style please.

I would also like to get a definitive root cause before we call this done, because it could be papering over another bug.

t.Fatalf("Failed to listen: %v", err)
}
defer lis.Close()
s := grpc.NewServer()
Copy link
Member

Choose a reason for hiding this comment

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

I think this needs to defer s.Stop() just in case GracefulStop() does hang (otherwise the leak detector hangs).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh interesting added.

@@ -273,3 +273,9 @@ func (st *serverTester) writeRSTStream(streamID uint32, code http2.ErrCode) {
st.t.Fatalf("Error writing RST_STREAM: %v", err)
}
}

func (st *serverTester) writeGoAwayPing(ack bool, data [8]byte) {
Copy link
Member

Choose a reason for hiding this comment

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

writePing? There's nothing about this ping that implies any relation to goaway besides the payload which is parameterized in data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh lol fair point good catch. Changed.

@zasweq zasweq changed the title transport: Fixed closing a closed channel panic in handlePing transport: Fix closing a closed channel panic in handlePing Dec 9, 2022
@zasweq zasweq merged commit 9373e5c into grpc:master Dec 13, 2022
1 check passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 19, 2023
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.

Multiple GOAWAY frames on graceful shutdown leads to crash when Swift clients are connected
2 participants