Skip to content

8293562: blocked threads with KeepAliveCache.get #10401

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

Closed
wants to merge 10 commits into from

Conversation

djelinski
Copy link
Member

@djelinski djelinski commented Sep 23, 2022

Please review this patch that makes sure KeepAliveCache does not block all threads while closing sockets.

Changes:

  • get operation no longer closes sockets; if there's no socket that is recent enough, get returns null and lets the cleaner thread close the sockets
  • put operation closes sockets without holding the cache lock. Additionally, if the cache is full, it places the new connection in the cache and removes the oldest connection.
  • the cleaner thread creates a list of connections to close, and then closes them after releasing the cache lock
  • additionally, we set the socket timeout to 1 millisecond before calling socket.close

The new test fails with Wait for second request timed out without this patch, passes after the changes. Tiers 1-3 clean.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10401

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 23, 2022

👋 Welcome back djelinski! 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 openjdk bot changed the title 8293562 8293562: blocked threads with KeepAliveCache.get Sep 23, 2022
@openjdk
Copy link

openjdk bot commented Sep 23, 2022

@djelinski 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 Sep 23, 2022
@djelinski djelinski marked this pull request as ready for review September 23, 2022 09:28
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 23, 2022
@mlbridge
Copy link

mlbridge bot commented Sep 23, 2022

Webrevs

Copy link
Member

@dfuch dfuch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good work overall - but I believe we should set the SO_TIMEOUT only for SSLSockets (in the HttpsClient subclass) - and make sure we do it everywhere where serverSocket.close() is called.

@djelinski
Copy link
Member Author

we should set the SO_TIMEOUT only for SSLSockets (in the HttpsClient subclass)

Done.

and make sure we do it everywhere where serverSocket.close() is called.

The only other place is checkURLSpoofing; I'd rather not touch that method here. It does not block the KeepAliveCache.

we should try catch and ignore exception

Done.

@openjdk
Copy link

openjdk bot commented Sep 28, 2022

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

8293562: blocked threads with KeepAliveCache.get

Reviewed-by: dfuchs, michaelm

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 139 new commits pushed to the master branch:

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 openjdk bot added the ready Pull request is ready to be integrated label Sep 28, 2022
Copy link
Member

@Michael-Mc-Mahon Michael-Mc-Mahon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@djelinski
Copy link
Member Author

Thanks for the reviews!

/integrate

@openjdk
Copy link

openjdk bot commented Oct 3, 2022

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

  • a69ee85: 8292336: JFR: Warn users if -XX:StartFlightRecording:disk=false is specified with maxage or maxsize
  • b8b9b97: 8294676: [JVMCI] InstalledCode.deoptimize(false) should not touch address field
  • fd59430: 8294610: java/net/vthread/HttpALot.java is slow on Linux
  • c7ab1ca: 8294609: C2: Improve inlining of methods with unloaded signature classes
  • 375f02f: 8294608: Remove redundant unchecked suppression in FileDescriptor
  • d207da8: 8294533: Documentation mistake in Process::getErrorStream and getInputStream
  • da4e96d: 8276545: Fix handling of trap count overflow in Parse::Parse()
  • 48674d4: 8291428: JFR: 'jfr print' displays incorrect timestamps during DST
  • 3b1bc21: 8294307: ISO 4217 Amendment 173 Update
  • b8f9a91: 8293940: Some tests for virtual threads take too long
  • ... and 142 more: https://git.openjdk.org/jdk/compare/bb422f5c14745bf29bc2cb741f819a17c8400543...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Oct 3, 2022

@djelinski Pushed as commit 03f25a9.

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

@djelinski djelinski deleted the keepalivecache-locking branch October 20, 2022 10:59
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.

4 participants