-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8342075: HttpClient: improve HTTP/2 flow control checks #21567
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
|
👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into |
|
@dfuch This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 85 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java
Outdated
Show resolved
Hide resolved
test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java
Outdated
Show resolved
Hide resolved
test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java
Outdated
Show resolved
Hide resolved
src/java.net.http/share/classes/jdk/internal/net/http/Stream.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Andrey Turbanov <turbanoff@gmail.com>
|
Thanks @turbanoff I applied your suggestions. |
| // This method is called when a DataFrame is dropped before/without | ||
| // having been added to any Stream::inputQ. In that case, the number | ||
| // of unprocessed bytes hasn't been incremented by the stream, and | ||
| // does not need to be decremented. |
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.
Hello Daniel, this comment looks a bit contradictory or confusing, since it says that this method gets called before/without the dataframe being added to the Stream::inputQ. But looking at the releaseUnconsumed method's implementation this dropDataFrame is being called from the releaseUnconsumed method, whose comment states "... called when a DataFrame that was added to a Stream::inputQ".
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.
Maybe I should say "is called directly" ? The idea is that if the data is dropped before being added to the inputQ, then dropDataFrame is called directly. If the data is dropped after having been added to the inputQ, then releaseUnconsumed is called.
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.
Maybe I should say "is called directly" ?
I think that would still be unclear since "directly" is contextual and depends on who is calling it. So we would then have to clarify what a direct call is.
Perhaps we should reword it to say that the dropDataFrame method gets called in two different ways. One when the data is dropped before adding to the inputQ and the other when the data is dropped through releaseUnconsumed.
| * or {@link #released(int)} must eventually be called to release | ||
| * the bytes from the flow control window. | ||
| * | ||
| * @implSpec |
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.
Is it intentional to use @implSpec here on an internal class. Or is it just to convey the intention?
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's to convey intention. There are two subclasses.
| // flow control window is exceeded. If so, take | ||
| // corrective actions and return true. | ||
| private boolean checkWindowSizeExceeded(int len) { | ||
| int rcv = Math.addExact(received.get(), len); |
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.
Math.addExact throws an ArithmeticException if there is an overflow. I think we should catch it here (and take some action) instead of letting it propagate.
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.
Good point. Maybe I should use a long to accumulate the two integers,
| * [2^16-1, 2^31-1]. If an invalid value is provided, the default value is used. | ||
| * The implementation guarantees that the actual value will be no smaller than the stream | ||
| * window size, which can be configured through the {@code jdk.httpclient.windowsize} | ||
| * system property. |
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.
Although these changes to the system property documentation are trivial, I think this would require a CSR, since these are "assertable" changes.
jaikiran
left a comment
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.
Overall this looks good to me. The newly added code comments were very helpful.
I haven't paid a very close attention to the tests but have glanced over them and those too look OK to me.
I have added a few minor review comments inline.
|
/csr |
|
@dfuch has indicated that a compatibility and specification (CSR) request is needed for this pull request. @dfuch please create a CSR request for issue JDK-8342075 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
jaikiran
left a comment
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.
Thank you for the updates Daniel. This looks good to me.
|
I see the CSR got approved. I'm running a last batch of tier2 tests and will integrate if they come back successful. |
|
/integrate |
|
Going to push as commit b0ac633.
Your commit was automatically rebased without conflicts. |
Please find here a fix that improves flow control in the HTTP/2 implementation.
The change makes sure that flow control issues are reported to the server as FLOW_CONTROL_ERROR.
It also clarify how some system properties that allow to initialize flow control windows are handled, by documenting the full range of valid values (when applicable) and explaining what happens if the property points to a value that is out of range.
Bad flow control values in the SETTINGS frame will also cause a FLOW_CONTROL_ERROR to be reported.
Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21567/head:pull/21567$ git checkout pull/21567Update a local copy of the PR:
$ git checkout pull/21567$ git pull https://git.openjdk.org/jdk.git pull/21567/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 21567View PR using the GUI difftool:
$ git pr show -t 21567Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21567.diff
Webrev
Link to Webrev Comment