Closed
Description
The lock up is more likely to happen with ServerGC configuration on a manycore machine.
The reason seems to be that at some stage of the process shutdown all threads except the main one get terminated regardless of what they do. With large number of attached threads (BGC threads are attached), it becomes fairly likely that one will be terminated while holding TSL spinlock.
Subsequently, when it is time for the main thread to detach, it blocks on the spinlock.
This scenario comes up frequently when, as a matter of stress testing, running library tests with ServerGC in a loop.
The issue seems to be specific to Windows.