Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4614317

destroy_vm and java_suspend race hangs VM

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0_01
    • 1.4.1
    • hotspot
    • None
    • 01
    • generic
    • generic

        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").

              hhuangsunw Hui Huang (Inactive)
              hhuangsunw Hui Huang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: