Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2050143 | 1.4.1 | Hui Huang | P4 | Closed | Fixed | hopper |
VM hangs in shutdown under this scenario (thread 1 is main thread, thread 2
could be any daemon thread but in this test it is the JVMPI sampler thread):
1. Thread 2 tries to suspend thread 1, it marks _external_suspend for thread 1
and queues up a VM_ThreadSuspend operation.
2. At the same time, thread 1 is in destroy_vm. It calls thread->exit().
3. VM_ThreadSuspend and then java_resume() are executed on thread 1. But they
have no effect since thread 1 is "terminated".
4. Thread 1 continues to execute in VMThread::execute(VM_SuspendDaemons). It
needs to lock VMOperationRequest_lock. Because thread 1 is Java thread,
this will eventually call Mutex::wait_for_lock_blocking_implementation.
5. _external_suspend remains true, so thread 1 will loop forever in
wait_for_lock_blocking_implementation (java_suspend_self does nothing
because thread 1 is "terminated").
could be any daemon thread but in this test it is the JVMPI sampler thread):
1. Thread 2 tries to suspend thread 1, it marks _external_suspend for thread 1
and queues up a VM_ThreadSuspend operation.
2. At the same time, thread 1 is in destroy_vm. It calls thread->exit().
3. VM_ThreadSuspend and then java_resume() are executed on thread 1. But they
have no effect since thread 1 is "terminated".
4. Thread 1 continues to execute in VMThread::execute(VM_SuspendDaemons). It
needs to lock VMOperationRequest_lock. Because thread 1 is Java thread,
this will eventually call Mutex::wait_for_lock_blocking_implementation.
5. _external_suspend remains true, so thread 1 will loop forever in
wait_for_lock_blocking_implementation (java_suspend_self does nothing
because thread 1 is "terminated").
- backported by
-
JDK-2050143 destroy_vm and java_suspend race hangs VM
- Closed
- relates to
-
JDK-4510834 JNI DestroyJavaVM/VMThread/sampler thread race hangs VM
- Closed