-
Notifications
You must be signed in to change notification settings - Fork 3.9k
netty: fix StreamBufferingEncoder GOAWAY bug #8020
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
Conversation
2b37b39
to
95060b2
Compare
The bug should come from the way The right way to handle goaway condition should be either
or
|
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.
It looks like this could be achieved without copying the buffering encoder.
This change looks like it might fail more RPCs that previously were allowed, because previously the failure required GOAWAY+MAX_CONCURRENT_STREAMS and now it just requires GOAWAY.
Is goAwayReceived() == true
during
// Try to allocate as many in-flight streams as possible, to reduce race window of |
How? And shouldn't
We can switch the order of if-conditions to retain the old behavior, then this is almost the same as approach 1:
|
Yes, we should fix any upstream bug in StreamBufferingEncoder. But I'd prefer to not copy the entire class if it were easy to avoid. With the current change it looks like we'd just need a
I do think it is essential to check |
As we are not able to check MAX_CONCURRENT_STREAMS number in |
That was equivalent behavior before your recent Netty changes. With the changes that have been made to netty/netty#11144 it is no longer equivalent. It is possible to do the isExistingStream/canCreateStream checks within gRPC, but we'd need to monitor maxConcurrentStreams. |
s = Status.INTERNAL.withDescription( | ||
"Failed due to abrupt GOAWAY, but can't find GOAWAY details"); | ||
if (connection().goAwayReceived()) { | ||
if (streamId > connection().local().lastStreamKnownByPeer() |
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.
Ordinarily I'd ask you to add a comment mentioning that checking for numActiveStreams is a workaround until we update to a netty version with netty/netty#11144.
However, I think we may need the numActiveStreams check. The error message "Abrupt GOAWAY closed unsent stream. HTTP/2 error code: NO_ERROR" is misleading when max concurrent streams is hit. Should we construct a special status in the case connection().local().numActiveStreams() == connection().local().maxActiveStreams()
? "At MAX_CONCURRENT_STREAMS limit and GOAWAY has been received. limit: " + maxActiveStreams()
I'm fine doing that as follow-up (or making a bug to track it; although that seems probably more work than just making the change).
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.
Filed #8097. Will fix in a follow-up PR.
There is a bug in
StreamBufferingEncoder
such that when client receives GOWAY while there are pending streams due to MAX_CONCURRENT_STREAMS, we see the following error:Made a local copy of
StreamBufferingEncoder
with fix.Also upstreamed the fix to netty/netty#11144