-
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
8291637: HttpClient default keep alive timeout not followed if server sends invalid value #9755
Conversation
👋 Welcome back michaelm! A progress list of the required criteria for merging this PR into |
@Michael-Mc-Mahon The following label will be automatically applied to this pull request:
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. |
Webrevs
|
@@ -901,6 +901,11 @@ private boolean parseHTTPHeader(MessageHeader responses, ProgressSource pi, Http | |||
/* default should be larger in case of proxy */ | |||
keepAliveConnections = p.findInt("max", usingProxy?50:5); |
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 Michael, should we do something similar for this max
parameter value too and (re)set the keepAliveConnections
to the defaults, if the server sends a negative value?
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.
Yes, that's a good suggestion. Will do.
/* | ||
* @test | ||
* @bug 8291637 | ||
* @run main/othervm -Dhttp.keepAlive.time.server=20 -esa -ea B8291637 |
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 that we are setting the -esa and -ea options here?
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.
If we enable assertions without the bug fix, then an assertion is triggered in KeepAliveCache, which is useful.
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 are usually run with -esa -ea
in our test systems, but individual developers could "forget" to specify those options. So in the case where it's the only thing that would make the test fail without the fix (or in the case where it would provide additional diagnostic for the particular bug fix) it can make sense to add them in the @run
too...
System.out.println("Time diff = " + diff); | ||
} | ||
} catch (IOException e) { | ||
System.err.println("Server exception terminating"); |
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 looks to me that if an exception occurs (not just IOException
) then this test might hang (and timeout with the jtreg timeout) at the passed.get()
call in the main()
method. Should we perhaps catch Throwable
here and do passed.completeExceptionally
?
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.
Seems reasonable.
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 changes, Michael. The updated version looks fine to me.
@Michael-Mc-Mahon 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 16 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 |
public void close() { | ||
try { | ||
serverSocket.close(); | ||
s.close(); |
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.
Could that trigger a NPE if s
is null?
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.
That could happen only if ServerSocket.accept
throws an exception, which I guess is possible. But, the client side would not get to call Server.close
then. I'll add a check anyway.
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.
Otherwise LGTM too
/integrate |
Going to push as commit b17a745.
Your commit was automatically rebased without conflicts. |
@Michael-Mc-Mahon Pushed as commit b17a745. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
/help |
@Michael-Mc-Mahon Available commands:
|
Hi,
Some new keep alive tests are exposing some old bugs. In this case if the server sends an invalid timeout (say -20 seconds) we accept it creating a timeout in the past. So, the first time the keep alive thread wakes up it will close the connection.
The correct behavior is to ignore the invalid parameter and fallback to the default timeout or the timeout set by the relevant system property.
Thanks,
Michael
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9755/head:pull/9755
$ git checkout pull/9755
Update a local copy of the PR:
$ git checkout pull/9755
$ git pull https://git.openjdk.org/jdk pull/9755/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9755
View PR using the GUI difftool:
$ git pr show -t 9755
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9755.diff