-
Notifications
You must be signed in to change notification settings - Fork 159
8293562: KeepAliveCache Blocks Threads while Closing Connections #409
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 dhanalla! A progress list of the required criteria for merging this PR into |
This backport pull request has now been updated with issue from the original commit. |
@dhanalla This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
adding a comment to keep the PR active. |
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 PR seems OK. It would have been easier to review if the whitespace wasn't all different. Consider adding jerboaa@054efe5 to make this more aligned with JDK 11u. Finally, I wonder if we should bring in https://bugs.openjdk.org/browse/JDK-8278067 first so as to make the patch cleaner (as compared to JDK 11). That one is in 8u361 oracle as well, so would probably good to have and seems low risk. Meanwhile, please apply for approval for #407 so this can get in.
long currentTime = System.currentTimeMillis(); | ||
do { | ||
KeepAliveEntry e = pop(); | ||
if ((currentTime - e.idleStartTime) > nap) { |
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.
Indenting is off.
for (HttpClient hc : closeList) { | ||
hc.closeServer(); | ||
} | ||
} |
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.
There are some whitespace issues here. Please clean this up.
} | ||
} | ||
// close after releasing locks | ||
if (oldClient != null) { | ||
oldClient.closeServer(); |
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.
Whitespace and aligned-ness of braces are off here.
Thanks @jerboaa for reviewing this PR. |
I am happy to backport the bug https://bugs.openjdk.org/browse/JDK-8278067, but my concern is that the backport of the other files in the PR (openjdk/jdk11u-dev#1193) may not be clean and could result in bringing in other changes. |
Yes, I'd prefer that. Get #407 integrated, then work on JDK-8278067 (it shouldn't require any other changes; at least that's my understanding when looking at the patch). Then rebase this one on top of JDK-8278067. JDK-8278067 might not be clean but it's a fairly contained change. |
The parent pull request that this pull request depends on has now been integrated and the target branch of this pull request has been updated. This means that changes from the dependent pull request can start to show up as belonging to this pull request, which may be confusing for reviewers. To remedy this situation, simply merge the latest changes from the new target branch into this pull request by running commands similar to these in the local repository for your personal fork: git checkout Backport-JDK-8293562
git fetch https://git.openjdk.org/jdk8u-dev.git master
git merge FETCH_HEAD
# if there are conflicts, follow the instructions given by git merge
git commit -m "Merge master"
git push |
@dhanalla this pull request can not be integrated into git checkout Backport-JDK-8293562
git fetch https://git.openjdk.org/jdk8u-dev.git pr/437
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge pr/437"
git push |
I'm surprised you think this is suitable for 8u. It's not low risk, and it's more of a performance fix than a bug, and it's P4. |
Thanks for reviewing this PR @theRealAph , I understand that this is not a Low-risk. We've observed that two of our valued customers' applications, which heavily rely on HttpClient and handle thousands of requests per second, encounter significant challenges with TLS 1.3. Specifically, these applications become almost unresponsive due to a huge number of blocked threads (The same issue is explained here https://techcommunity.microsoft.com/t5/azure-storage-blog/prepare-for-upcoming-tls-1-3-support-for-azure-storage/ba-p/4034014) Unfortunately, due to various constraints, these customers are unable to upgrade to the later JDK version or revert to TLS 1.2. Both of these customers have explicitly conveyed that implementing this fix would greatly alleviate their current roadblocks. The attached test simulates a scenario in which the second HTTP client read request fails with a timeout as it is blocked by the first socket close connection. This blocking occurs due to synchronization locks in the KeepAliveCache's put and Keep-Alive-Timer thread methods, with the Keep-Alive-Timer thread handling socket closure while holding a lock. This means that while it's closing connections, no other connections can be established, retrieved from the cache, or added to the cache. And the test passes with the fix. |
|
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 seems OK now modulo some whitespace changes. The best course of action would be to compare the KeepAliveCache.java
file to the version from jdk11u
and fix the whitespace changes in the current version. The only difference then should be in the AccessController.doPrivileged(
block between JDK 8 and 11 and nothing else.
http tests pass for me:
Passed: sun/net/www/http/ChunkedInputStream/ChunkedEncodingTest.java
Passed: sun/net/www/http/ChunkedInputStream/ChunkedEncodingWithProgressMonitorTest.java
Passed: sun/net/www/http/ChunkedInputStream/TestAvailable.java
Passed: sun/net/www/http/ChunkedOutputStream/checkError.java
Passed: sun/net/www/http/ChunkedOutputStream/Test.java
Passed: sun/net/www/http/HttpClient/B6726695.java
Passed: sun/net/www/http/HttpClient/B7025238.java
Passed: sun/net/www/http/HttpClient/B8025710.java
Passed: sun/net/www/http/HttpClient/B8209178.java
Passed: sun/net/www/http/HttpClient/CookieHttpClientTest.java
Passed: sun/net/www/http/HttpClient/GetProxyPort.java
Passed: sun/net/www/http/HttpClient/ImplicitFileName.java
Passed: sun/net/www/http/HttpClient/IsAvailable.java
Passed: sun/net/www/http/HttpClient/IsKeepingAlive.java
Passed: sun/net/www/http/HttpClient/KeepAliveTest.java
Passed: sun/net/www/http/HttpClient/MultiThreadTest.java
Passed: sun/net/www/http/HttpClient/OpenServer.java
Passed: sun/net/www/http/HttpClient/ProxyFromCache.java
Passed: sun/net/www/http/HttpClient/ProxyTest.java
Passed: sun/net/www/http/HttpClient/RequestURI.java
Passed: sun/net/www/http/HttpClient/RetryPost.sh
Passed: sun/net/www/http/HttpClient/StreamingRetry.java
Passed: sun/net/www/http/HttpURLConnection/PostOnDelete.java
Passed: sun/net/www/http/KeepAliveCache/B5045306.java
Passed: sun/net/www/http/KeepAliveCache/B8291637.java
Passed: sun/net/www/http/KeepAliveCache/B8293562.java
Passed: sun/net/www/http/KeepAliveCache/KeepAliveProperty.java
Passed: sun/net/www/http/KeepAliveCache/KeepAliveTimerThread.java
Passed: sun/net/www/http/KeepAliveStream/InfiniteLoop.java
Passed: sun/net/www/http/KeepAliveStream/KeepAliveStreamClose.java
Passed: sun/net/www/http/KeepAliveStream/KeepAliveStreamCloseWithWrongContentLength.java
Passed: sun/net/www/http/RequestMethodCheck/RequestMethodEquality.java
Test results: passed: 32
Done |
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 looks OK to me, but I'd like for somebody else to give the go-ahead as well.
|
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. The only real difference from the 11u backport looks to be the keepAliveTimer thread creation code.
Thanks @jerboaa & @phohensee for reviewing this PR. |
This now looks correct after applying the patch, though the 8u & 11u patches look different to achieve the same end result. There's an additional whitespace change which I'm not sure if it was missed in an earlier backport or 8u only to begin with, but the file looks good after this patch, which is the main thing. |
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.
Backport looks good.
/approve yes |
@gnu-andrew |
/integrate |
Thanks @gnu-andrew for reviewing this PR. |
/sponsor |
Going to push as commit 853a87a.
Your commit was automatically rebased without conflicts. |
@gnu-andrew @dhanalla Pushed as commit 853a87a. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Issue: JDK-8293562: KeepAliveCache Blocks Threads while Closing Connections
Backport of PR openjdk/jdk11u-dev#1890 fromJDK11 to JDK8.
The JDK11 patch doesn't apply cleanly 3/11 hunks need to be ported manually in KeepAliveCache.java.
Test performed:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk8u-dev.git pull/409/head:pull/409
$ git checkout pull/409
Update a local copy of the PR:
$ git checkout pull/409
$ git pull https://git.openjdk.org/jdk8u-dev.git pull/409/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 409
View PR using the GUI difftool:
$ git pr show -t 409
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk8u-dev/pull/409.diff
Webrev
Link to Webrev Comment