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

Richard Reingruber rrich at openjdk.org
Thu Mar 28 15:16:33 UTC 2024


On Thu, 28 Mar 2024 13:14:49 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> It's `Universe::heap()->gc_threads_do` that may contain terminated threads, not any other kinds of`NonJavaThreads`, right?

`WatcherThread`, `NativeHeapTrimmerThread` can also be terminated. The latter is not shown by `Threads::print_on` though (even `Threads::print_on_error` doesn't show it which surprises me a little bit).

`WatcherThread::watcher_thread()` will return null when the WatcherThread was stopped. So the issue is rather unlikely.

> If so, can the fix be placed in `gc_threads_do`, where every collector ensures only active gc threads are visited.
> 
> (I see that David made a similar remark in the bug report.)

Ok. I'll wait a bit and shall close this pr if nobody thinks this approach should be taken.

(Btw: `G1CollectedHeap::stop()` doesn't stop `G1CollectedHeap::_cm`. Likely an oversight)

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

PR Comment: https://git.openjdk.org/jdk/pull/18518#issuecomment-2025469671


More information about the hotspot-gc-dev mailing list