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

race between JNI DestroyJavaVM() and safepoint hits too tight assertion

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.4.0
    • vm-legacy
    • None
    • rc1
    • generic
    • generic
    • Verified



        Name: dd4877 Date: 10/03/2001


        daniel.daugherty@sun 2001-10-03

        One of my profiling stress runs crashed on the following assertion
        failure:

        This run crashed on the following assertion failure:

        # assert(state == _thread_in_Java || state == _thread_new_trans
        # || state == _thread_in_native || state == _thread_in_native_trans,
        # "a suspended thread should have thread state in_native, in_Java, or just start
        ed")
        #
        # Error ID: baseline-stress/src/share/vm/runtime/safepoint.cpp, 438 [ Patched ]

        While the VMThread was calling SafepointSynchronize::begin(),
        examine_state_of_thread() found a suspended thread with an unexpected
        thread state value. This was caused by a race between JNI
        DestroyJavaVM() and safepointing.

        Here is the scenario:

        - JNI DestroyJavaVM() has been called
          - it queues up a VM_SuspendDaemons operation
          - it is waiting in VMThread::wait_for_vm_thread_exit()
        - VMThread
          - processes the VM_SuspendDaemons operation which is defined as an
            "evaluate at safepoint" operation
        - JavaThread (daemon)
          - coming out of an Object.wait()
          - sees that there is a pending safepoint
          - blocks in the thread state transition from _thread_blocked to
            _thread_in_vm (state now _thread_blocked_trans)
          - gets suspended by the VMThread
        - VMThread
          - does another safepoint (we have SafepointALot set)
          - fails the assertion

        ======================================================================

              dcubed Daniel Daugherty
              dcubed Daniel Daugherty
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: