RFR: 8309406: Change jdk.trackAllThreads to default to true

Alan Bateman alanb at openjdk.org
Mon Jun 5 15:54:33 UTC 2023


Virtual threads created directly with the Thread API are not included in the new thread dump by default. This was a source of confusion in JDK 19/20 when virtual threads were in preview. We have decided to switch the default so that all virtual threads are observable. Future work will reduce/remove the overhead of tracking threads in the root container. The change proposed here has no impact to virtual threads created with the virtual ThreadPerTaskExecutor or StructuredTaskScope.

With jdk.trackAllThreads defaulting to true then the need for SharedThreadContainer to count threads can go away, as does the need for RootContainer::threads to return virtual threads blocked on I/O.

Most of the changes are to the test HotSpotDiagnosticMXBean/DumpThreads.java as this is expanded to cover more cases, and specifically more cases with thread groupings that correspond to the ThreadPerTaskExecutor and thread pools.

Testing: Test1-5

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

Commit messages:
 - requires vm.continuations
 - Initial commit

Changes: https://git.openjdk.org/jdk/pull/14300/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14300&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8309406
  Stats: 319 lines in 6 files changed: 183 ins; 81 del; 55 mod
  Patch: https://git.openjdk.org/jdk/pull/14300.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14300/head:pull/14300

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


More information about the serviceability-dev mailing list