RFR: 8329109: Threads::print_on() tries to print CPU time for terminated GC threads [v2]

Richard Reingruber rrich at openjdk.org
Tue Apr 2 12:28:10 UTC 2024


> Make use of `Threads::threads_do()` if at a safepoint to print the threads.
> `Threads::threads_do()` uses thread list iterators that don't visit terminated threads.
> If a non-java thread is about to terminate, it waits for in progress iterations (see [NonJavaThread::remove_from_the_list](https://github.com/openjdk/jdk/blob/47f33a59eaaffc74881fcc9e29d13ff9b2538c2a/src/hotspot/share/runtime/nonJavaThread.cpp#L97-L102)).
> 
> Only debug code calls `Threads::print_on()` outside a safepoint if I'm not mistaken so this solution should work in the relevant cases (jcmd, SIGQUIT, ...).
> 
> Testing:
> 
> The output of a minimal example with G1 is almost identical. The order of `NonJavaThreads` can differ.
> 
> More tests (besides GHA) are pending.

Richard Reingruber has updated the pull request incrementally with two additional commits since the last revision:

 - Equivalent but simpler fix
 - Revert
   
   This reverts commit 568a2bcc7a1c99ba9f95a33dbcb80eb511ead94b.

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/18518/files
  - new: https://git.openjdk.org/jdk/pull/18518/files/568a2bcc..b2dabc95

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=18518&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18518&range=00-01

  Stats: 63 lines in 1 file changed: 8 ins; 40 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/18518.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18518/head:pull/18518

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


More information about the hotspot-gc-dev mailing list