jdk17u-dev icon indicating copy to clipboard operation
jdk17u-dev copied to clipboard

8340547: Starting many threads can delay safepoints

Open snazarkin opened this issue 9 months ago • 21 comments
trafficstars

I'd like to backport this fix to fix the issue with starting a lot of threads in a burst.

Despite the low priority of this issue, some users have found this to be a barrier to migrating from JDK8.

The backport is not clean as it needs to adjust globals.hpp and replace ConditionalMutexLocker with classic MutexLocker. The rank nonleaf of UseThreadsLockThrottleLock has been chosen to be as close as possible to the rank of Threads_lock and to not cause a crash in debug mode:

#  Internal Error (/home/ubuntu/jdk17u-dev/src/hotspot/share/runtime/mutex.cpp:398), pid=1777, tid=1782
#  assert(false) failed: Attempting to acquire lock Threads_lock/22 out of order with lock ThreadsLockThrottle_lock/22 -- possible deadlock

Field _allow_vm_block is set to false to prevent

#  Internal Error (/home/ubuntu/jdk17u-dev/src/hotspot/share/runtime/thread.cpp:981), pid=56846, tid=56851
#  assert(false) failed: Possible safepoint reached by thread that does not allow it

Similar PR is on review at jdk21 Original fix and discussion are https://github.com/openjdk/jdk/pull/21111

Tested with tier1 (release), tier2(fastdebug), and reproducers from JDK-8340547, JDK-8307970


Progress

  • [ ] Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • [x] Change must not contain extraneous whitespace
  • [x] Commit message must refer to an issue
  • [ ] JDK-8340547 needs maintainer approval

Issue

  • JDK-8340547: Starting many threads can delay safepoints (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk17u-dev.git pull/3263/head:pull/3263
$ git checkout pull/3263

Update a local copy of the PR:
$ git checkout pull/3263
$ git pull https://git.openjdk.org/jdk17u-dev.git pull/3263/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3263

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk17u-dev/pull/3263.diff

Using Webrev

Link to Webrev Comment

snazarkin avatar Feb 03 '25 08:02 snazarkin

:wave: Welcome back snazarki! 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.

bridgekeeper[bot] avatar Feb 03 '25 08:02 bridgekeeper[bot]

❗ This change is not yet ready to be integrated. See the Progress checklist in the description for automated requirements.

openjdk[bot] avatar Feb 03 '25 08:02 openjdk[bot]

This backport pull request has now been updated with issue from the original commit.

openjdk[bot] avatar Feb 03 '25 08:02 openjdk[bot]

Webrevs

mlbridge[bot] avatar Feb 03 '25 08:02 mlbridge[bot]

@snazarkin 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!

bridgekeeper[bot] avatar Mar 03 '25 09:03 bridgekeeper[bot]

@snazarkin This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

bridgekeeper[bot] avatar Mar 31 '25 13:03 bridgekeeper[bot]

@snazarkin Can you reopen this pull request ?

xiezhaokun avatar Aug 26 '25 07:08 xiezhaokun

/open

snazarkin avatar Aug 26 '25 08:08 snazarkin

@snazarkin This pull request is now open

openjdk[bot] avatar Aug 26 '25 08:08 openjdk[bot]

/reviewer credit @olivergillespie /reviewer credit @dimitryc

snazarkin avatar Aug 26 '25 08:08 snazarkin

@snazarkin Reviewer ogillespie successfully credited.

openjdk[bot] avatar Aug 26 '25 08:08 openjdk[bot]

@snazarkin Reviewer dcherepanov successfully credited.

openjdk[bot] avatar Aug 26 '25 08:08 openjdk[bot]

/reviewers 1

snazarkin avatar Aug 26 '25 08:08 snazarkin

@snazarkin The total number of required reviews for this PR (including the jcheck configuration and the last /reviewers command) is now set to 1 (with at least 1 Reviewer).

openjdk[bot] avatar Aug 26 '25 08:08 openjdk[bot]

@olivergillespie could you please review the patch?

snazarkin avatar Aug 26 '25 09:08 snazarkin

@snazarkin 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 issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Sep 23 '25 17:09 bridgekeeper[bot]

/touch

snazarkin avatar Sep 24 '25 08:09 snazarkin

@snazarkin The pull request is being re-evaluated and the inactivity timeout has been reset.

openjdk[bot] avatar Sep 24 '25 08:09 openjdk[bot]

@snazarkin 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 issue a /touch or /keepalive command to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

bridgekeeper[bot] avatar Oct 22 '25 21:10 bridgekeeper[bot]

/touch

snazarkin avatar Oct 23 '25 05:10 snazarkin

@snazarkin The pull request is being re-evaluated and the inactivity timeout has been reset.

openjdk[bot] avatar Oct 23 '25 05:10 openjdk[bot]