RFR: Do not visit gc threads during shutdown
William Kemper
wkemper at openjdk.org
Mon Mar 20 21:05:22 UTC 2023
On Mon, 20 Mar 2023 19:09:46 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:
>> Discovered a strange crash during shutdown while working on jtreg tests.
>
> src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp line 1807:
>
>> 1805: return;
>> 1806: }
>> 1807:
>
> Some related questions so I can understand the shutdown sequence a bit better, and what caused the issue that @kdnilsen recorded in the ticket:
>
> 1. I suppose we have determined that the shutdown sequence doesn't itself need to iterate over these GC-related threads to do anything.
> 2. was the original issue because one of the threads gone by the time we started iterating over it with the closure below?
> 3. what prevents a race between the check above and the exit of the threads subject to iteration below, so that some of the threads may be asynchronously gone between the check above and the iteration over that thread below?
>
> Thanks!
1. The shutdown sequence doesn't need to iterate over the threads.
2. The crashing thread wasn't "gone", but it's termination had been requested. It crashed in a call to get the thread's clock time (pthread_getcpuclockid). The thread's native handle should still have been valid. I didn't fully root cause the crash.
3. In this case, it was the control thread itself that was trying to iterate the threads. The fix here will stop the control thread from starting an iteration of the threads _after_ the shutdown sequence has begun, but it is not so robust to cover a shut down during an iteration of the threads.
-------------
PR Review Comment: https://git.openjdk.org/shenandoah/pull/228#discussion_r1142674640
More information about the shenandoah-dev
mailing list