RFR: 8369250: Assess and remedy any unsafe usage of the Semaphore used by NonJavaThread::List

David Holmes dholmes at openjdk.org
Tue Oct 7 06:20:20 UTC 2025


The `NonJavaThread::List` has a statically allocated instance which contains a `SingleWriterSynchronizer`, which contains a `Semaphore`. The `VMThread` can try to remove itself from the list after the static destructors have executed, leading to an assertion failure for the `Semaphore` but potentially it could crash as the `List` itself gets deallocated..  Simplest fix is to change the `List` instance to a `DeferredStatic` such that it is never destroyed.

Testing:
 - tiers 1-3 (sanity)

Thanks.

-------------

Commit messages:
 - Merge
 - Fix the NJT::List and its embedded Semaphore

Changes: https://git.openjdk.org/jdk/pull/27664/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27664&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8369250
  Stats: 39 lines in 3 files changed: 18 ins; 9 del; 12 mod
  Patch: https://git.openjdk.org/jdk/pull/27664.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27664/head:pull/27664

PR: https://git.openjdk.org/jdk/pull/27664


More information about the hotspot-runtime-dev mailing list