-
Notifications
You must be signed in to change notification settings - Fork 565
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
4.x Http2Connection should ignore a max concurrent streams setting of zero from the client #7346
Conversation
…o from the client
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.
This looks more like a bug in the mentioned netty based client, citing the spec:
A value of 0 for SETTINGS_MAX_CONCURRENT_STREAMS SHOULD NOT be treated as special by endpoints. A zero value does prevent the creation of new streams; however, this can also happen for any limit that is exhausted with active streams. Servers SHOULD only set a zero value for short durations; if a server does not wish to accept requests, closing the connection is more appropriate.
Where A zero value does prevent the creation of new streams
is important, we have to honor the 0 value like any other.
According to my understanding:
|
...grpc/server/src/main/java/io/helidon/nima/tests/integration/grpc/webserver/EventService.java
Outdated
Show resolved
Hide resolved
// Set server MAX_CONCURRENT_STREAMS limit when client sends number lower than hard limit | ||
// from configuration. Refuse settings if client sends larger number than is configured. | ||
this.clientSettings.presentValue(Http2Setting.MAX_CONCURRENT_STREAMS) | ||
.ifPresent(it -> { | ||
if (http2Config.maxConcurrentStreams() >= it) { | ||
maxClientConcurrentStreams = it; | ||
} else { | ||
Http2GoAway frame = | ||
new Http2GoAway(0, | ||
Http2ErrorCode.PROTOCOL, | ||
"Value of maximum concurrent streams limit " + it | ||
+ " exceeded hard limit value " | ||
+ http2Config.maxConcurrentStreams()); | ||
connectionWriter.write(frame.toFrameData(clientSettings, 0, Http2Flag.NoFlags.create())); | ||
} | ||
}); |
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.
👍
…to explain what it does.
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.
Cool thx for the fix!
Although Daniel has approved this I do not have permissions to merge it so someone else will need to do it. Also, the build fails but I don't think it is related to this change as it is a different test failure every time I re-run the failing validate build. |
The Http2Connection updates some of its configuration based on that sent by the client. One of the config items updated is the "max concurrent streams" setting. The problem is that if the client sends zero for this setting then things can break. I discovered this when a number of our Coherence gRPC tests broke when I switched the server to use Nima and the client is still using grpc-java and Netty.
Client libraries such as
grpc-java
hard code this value to be zero and this breaks gRPC because the server cannot send messages down multiple streams. I have added an example of this where I have an existing bi-di channel request open and then send another request from the client that causes the server to send a message down the bi-di channel. This will break without the fix in this PR.The fix I have done here is to ignore changing the "max concurrent streams" setting on the server if the client sends zero. then the grpc-java clients work. It might well be that I have mis-understood something about "max concurrent streams" and how the server should handle a value of zero. Trying to find out anything on the internet was all a bit vague.
I added a test
nima/tests/integration/grpc/server/src/test/java/io/helidon/nima/tests/integration/grpc/webserver/EventsTest.java
which works with my fix and fails without it.