-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
6968351: httpserver clashes with delayed TCP ACKs for low Content-Length #18667
Conversation
Hi @robaho, welcome to this OpenJDK project and thanks for contributing! We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user robaho" as summary for the issue. If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing |
@robaho 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 418 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@dfuch, @djelinski, @Michael-Mc-Mahon, @jaikiran) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/signed |
Thank you! Please allow for up to two weeks to process your OCA, although it is usually done within one to two business days. Also, please note that pull requests that are pending an OCA check will not usually be evaluated, so your patience is appreciated! |
Webrevs
|
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.
Hi Robert, thanks for working on this issue.
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 is not as complex as I expected it to be. Which is a good thing!
Some tests are failing with this change. See:
test/jdk/sun/net/www/http/KeepAliveCache/B8293562.java
test/jdk/java/net/Authenticator/B4769350.java
These tests don't close the exchange or the output stream after sending the response, and the headers are never flushed. Users might have similar code, so I think a release note might be needed.
src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
Outdated
Show resolved
Hide resolved
I think this is a trivial fix. We should be able to either:
I think 1 is the better option - because you can't really use a chunked output stream without flushing or closing the stream - as the client would hang. |
This is reasonable, and should fix
The exchange does not automatically complete when you exit the This behavior enables users to asynchronously handle the exchange outside of the |
This is a concern. Release note needed at least or I wonder if the new behavior should be enabled through a configuration switch. Probably not worth going to that extreme, but we need to consider the compatibility impact carefully. |
I think these tests that are failing are incorrect, as in this case, the connection is corrupted - if the client attempts to send another request on the connection it will hang - since the handler never closed the output stream it won't be ready for another request. |
I don't understand this. If the handler "leaks it", isn't that a bug? If sending a chunked response I think you have to close the output stream or end the exchange otherwise it is a bug in the handler code. Also, in reviewing the code, I don't think the old code could have worked either. If you don't close() the stream or the exchange() then the write finished event is never fired so the internals will be messed up - and the connection will hang. |
Yes it is a bug. But even with the bug the code used to work, and now it doesn't. Users might have similar buggy code that will stop working when they get this fix. We need to post a release note so that they know what to expect. |
Are you sure it worked? I think the connection would be "dead" - the client would see the last response - but if it tried to send another request on the connection it would hang - because WriteFinished event would never have been emitted - and so the exchange/connection would never be read for another request. |
This reverts commit 207a3a9.
…putStream.java Co-authored-by: Daniel Fuchs <67001856+dfuch@users.noreply.github.com>
I created a PR for the related proposed api changes #18955 |
I don't think I have the ability to create issues, so I can't create one for the api changes. |
|
@@ -25,7 +25,7 @@ | |||
* @test | |||
* @summary Test to stress directory listings | |||
* @library /test/lib | |||
* @run testng/othervm/timeout=180 -Dsun.net.httpserver.nodelay=true StressDirListings | |||
* @run testng/othervm/timeout=180 StressDirListings |
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 Varada @varada1110, in #17363 this StressDirListings
test was updated to set the -Dsun.net.httpserver.nodelay=true
because without it, the test was failing on AIX. The current PR here is proposing to fix the underlying issue in the HttpServer implementation and is rolling back the addition of this system property to this StressDirListings
test. Could you or someone from the AIX team please build the latest mainline JDK and apply this current PR on top of it and rerun the test(s) to verify that this change is OK?
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.
Hi @jaikiran, I have performed jtreg test on AIX and all the tests are passing.
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 Varada for running the tests.
I created a new Jira issue for this. It's at: https://bugs.openjdk.org/browse/JDK-8331195 |
done. |
FYI: I'm running tests with the proposed changes in our CI to check that we do not get new intermittent failures. If tests come back green, and if @Michael-Mc-Mahon is happy with the changes, then one of us will sponsor. |
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 fine. Thanks for the contribution.
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.
LGTM. In order to proceed, use the /integrate
command; see the guide for details.
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.
Tests were green. Please integrate and one of us will sponsor.
/integrate |
/sponsor |
Going to push as commit 02c95a6.
Your commit was automatically rebased without conflicts. |
fix bug JDK-B6968351 by avoiding flush after response headers
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18667/head:pull/18667
$ git checkout pull/18667
Update a local copy of the PR:
$ git checkout pull/18667
$ git pull https://git.openjdk.org/jdk.git pull/18667/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18667
View PR using the GUI difftool:
$ git pr show -t 18667
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18667.diff
Webrev
Link to Webrev Comment