Skip to content

Conversation

@dfuch
Copy link
Member

@dfuch dfuch commented Oct 17, 2024

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

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Change requires CSR request JDK-8342834 to be approved
  • Commit message must refer to an issue

Issues

  • JDK-8342075: HttpClient: improve HTTP/2 flow control checks (Bug - P4)
  • JDK-8342834: HttpClient: improve HTTP/2 flow control checks (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/21567/head:pull/21567
$ git checkout pull/21567

Update a local copy of the PR:
$ git checkout pull/21567
$ git pull https://git.openjdk.org/jdk.git pull/21567/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 21567

View PR using the GUI difftool:
$ git pr show -t 21567

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/21567.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 17, 2024

👋 Welcome back dfuchs! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Oct 17, 2024

@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:

8342075: HttpClient: improve HTTP/2 flow control checks

Reviewed-by: jpai

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 master branch:

  • 98403b7: 8342854: [JVMCI] Block secondary thread reporting a JVMCI fatal error
  • 9a7a850: 8341939: SigningOptionsTest fails without Xcode with command line developer tools after JDK-8341443
  • de92fe3: 8233451: (fs) Files.newInputStream() cannot be used with character special files
  • 002de86: 8342673: Test serviceability/jvmti/events/NotifyFramePopStressTest/NotifyFramePopStressTest.java failed: waited too long for notify
  • a21c558: 8342863: Use pattern matching for instanceof in equals methods of wrapper classes
  • e64f079: 8342582: user.region for formatting number no longer works for 21.0.5
  • 426da4b: 8341975: Unable to set encoding for IO.println, IO.print and IO.readln
  • a522d21: 8342858: Make target mac-jdk-bundle fails on chmod command
  • afb62f7: 8342683: Use non-short forward jump when passing stop()
  • 964d8d2: 8340445: [PPC64] Wrong ConditionRegister used in ppc64.ad: flagsRegCR0 cr1
  • ... and 75 more: https://git.openjdk.org/jdk/compare/236c71cad9fa269518456c11edcfb353bbfc084d...master

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 master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Oct 17, 2024

@dfuch The following label will be automatically applied to this pull request:

  • net

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the net net-dev@openjdk.org label Oct 17, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Oct 17, 2024
@mlbridge
Copy link

mlbridge bot commented Oct 17, 2024

Webrevs

Co-authored-by: Andrey Turbanov <turbanoff@gmail.com>
@dfuch
Copy link
Member Author

dfuch commented Oct 21, 2024

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.
Copy link
Member

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".

Copy link
Member Author

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.

Copy link
Member

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
Copy link
Member

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?

Copy link
Member Author

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);
Copy link
Member

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.

Copy link
Member Author

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.
Copy link
Member

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.

Copy link
Member

@jaikiran jaikiran left a 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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 22, 2024
@dfuch
Copy link
Member Author

dfuch commented Oct 22, 2024

/csr

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Oct 22, 2024
@openjdk
Copy link

openjdk bot commented Oct 22, 2024

@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.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Oct 22, 2024
Copy link
Member

@jaikiran jaikiran left a 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.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 23, 2024
@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Oct 23, 2024
@dfuch
Copy link
Member Author

dfuch commented Oct 24, 2024

I see the CSR got approved. I'm running a last batch of tier2 tests and will integrate if they come back successful.

@dfuch
Copy link
Member Author

dfuch commented Oct 24, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Oct 24, 2024

Going to push as commit b0ac633.
Since your change was applied there have been 93 commits pushed to the master branch:

  • 85774b7: 8342882: RISC-V: Unify handling of jumps to runtime
  • 2c31c8e: 8339730: Windows regression after removing ObjectMonitor Responsible
  • f0b130e: 8339296: Record deconstruction pattern in switch fails to compile
  • e96b4cf: 8342387: C2 SuperWord: refactor and improve compiler/loopopts/superword/TestDependencyOffsets.java
  • f7a61fc: 8342931: ProblemList failing tests from JDK-8335912
  • 25c2f48: 8338544: Dedicated Array class descriptor implementation
  • 158b93d: 8335912: Add an operation mode to the jar command when extracting to not overwriting existing files
  • 28d23ad: 8340177: Malformed system classes loaded by bootloader crash the JVM in product builds
  • 98403b7: 8342854: [JVMCI] Block secondary thread reporting a JVMCI fatal error
  • 9a7a850: 8341939: SigningOptionsTest fails without Xcode with command line developer tools after JDK-8341443
  • ... and 83 more: https://git.openjdk.org/jdk/compare/236c71cad9fa269518456c11edcfb353bbfc084d...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 24, 2024
@openjdk openjdk bot closed this Oct 24, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 24, 2024
@openjdk
Copy link

openjdk bot commented Oct 24, 2024

@dfuch Pushed as commit b0ac633.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated net net-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

3 participants