-
Notifications
You must be signed in to change notification settings - Fork 3.9k
okhttp: fix incorrect connection-level flow control handling at beginning of connection #6742
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
Thanks for sending this out. I didn't send it out earlier because it clearly deserved some tests. I was on vacation for a bit over a week, thus the delay. Thank you testing this and confirming the OutboundFlowController argument was garbage. You'd need to sign the CLA for us to accept the PR. We can work on some tests and make a PR, if that is easiest. |
I signed it |
Hm, I signed the CLA (both on EasyCLA and the CNCF one linked in the contributing docs last week but it doesn't seem to be picking that up. I took a stab at testing the changes:
|
2fd5b20
to
8da3539
Compare
Mystery solved – my commits had the wrong email address on them. :) |
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 pretty good. Just one thing to fix-up.
@@ -838,37 +868,34 @@ public void windowUpdateWithInboundFlowControl() throws Exception { | |||
|
|||
@Test | |||
public void outboundFlowControl() throws Exception { | |||
outboundFlowControl(INITIAL_WINDOW_SIZE); |
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.
I think these three tests should still be around. They are trying to test that the outbound flow controller observes the flow control given to it. Since passing windowSize
to startTransport()
no longer works, these need to get something like frameHandler().settings(false, new Settings());
(but with the INITIAL_WINDOW_SIZE set to windowSize
) to change the window size available.
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.
Done. I initially thought those cases were already covered by outboundFlowControlWithInitialWindowSizeChange()
, but realized it wasn't testing where the initial window size is changed before the stream is started.
66b5856
to
671dd33
Compare
@chrisschek, thank you! I was on vacation last week so I'm happy that you worked on this. Sorry you were bit by this silly bug! |
@ejona86 not a problem, happy to contribute :) |
…ning of connection (v1.28.x backport) Specifically, this addresses bugs that occur when the `OkHttpChannelBuilder.flowControlWindow(int)` setting is increased from its default value. Two changes: 1. On starting a connection, ensure the value of `OkHttpChannelBuilder.flowControlWindow(int)` is sent via Settings.INITIAL_WINDOW_SIZE. Also send a WINDOW_UPDATE after Settings to update the connection-level window. 2. Always initialize the `OutboundFlowController` with an initialWindowSize of 65335 bytes per the [http2 spec](https://http2.github.io/http2-spec/#InitialWindowSize) instead of using the inbound window size. Fixes #6685 Backport of #6742
Addressing #6685
Specifically, this addresses bugs that occur when the
OkHttpChannelBuilder.flowControlWindow(int)
setting is increased from its default value.Two changes:
OkHttpChannelBuilder.flowControlWindow(int)
is sent via Settings.INITIAL_WINDOW_SIZE. Also send a WINDOW_UPDATE after Settings to update the connection-level window.OutboundFlowController
with an initialWindowSize of 65335 bytes per the http2 spec instead of using the inbound window size.