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

before_exit/VMThread/otherThread deadlock

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 6
    • vm-legacy
    • None
    • mustang
    • generic
    • generic

      ###@###.### 2003-06-19

      Here is the first variation of this deadlock:

      The Java2Demo program is done and has called System.exit(0).
      The JVM_Halt thread calls before_exit() and then requests a
      VM_Exit operation. The VMThread is trying to execute a
      safepoint. A JavaThread is executing a monitorexit bytecode and
      receives a SIGPROF. This JavaThread is still "running".
      The VMThread is in SafepointSynchronize::begin() in the
      'while(still_running > 0)' loop waiting for the JavaThread to
      stop running.

      The SIGPROF handler calls JVM/PI GetThreadLocalStorage() and
      because of the before_exit() call, the real handler for the API
      has been replaced with a call to _block().

      Here is a stack trace snippet from the JavaThread that called
      _block():

      THREAD t@41

        [6] os::yield_all(attempts = 100), line 2046 in "os_solaris.cpp"
        [7] _block(), line 176 in "jvmpi.cpp"
        [8] profhandler(sig = 29, siginfo = 0xd1d3fa38, ucontext = 0xd1d3f838), line 1
      31 in "b4757672.c"
        [9] __sighndlr(0x1d, 0xd1d3fa38, 0xd1d3f838, 0xdcbe1008), at 0xdfb92963
        [10] call_user_handler(0x1d, 0xd1d3fa38, 0xd1d3f838), at 0xdfb8e0b6
        [11] sigacthandler(), at 0xdfb8e1e0
        ---- called from signal handler with signal 29 (SIGPROF) ------
        [12] __lwp_mutex_unlock(0x8127f54), at 0xdfaeb80c
        [13] os::Solaris::mutex_unlock(mx = 0x8127f54), line 178 in "os_solaris.hpp"
        [14] os::Solaris::OSMutex::unlock(this = 0x8127f48), line 515 in "os_solaris.h
      pp"
        [15] ObjectMonitor::exit(this = 0x8127f2c, __the_thread__ = 0x85c0b58), line 2
      80 in "objectMonitor_solaris.cpp"
        [16] ObjectSynchronizer::slow_exit(object = 0xd28ef798, lock = 0xd1d3fbc4, __t
      he_thread__ = 0x85c0b58), line 351 in "synchronizer.cpp"
        [17] Runtime1::monitorexit(thread = 0x85c0b58, lock = 0xd1d3fbc4), line 907 in
       "c1_Runtime1.cpp"

      The complete stack trace is attached as threads.log.41.


      Here is the second variation of this deadlock:

      The CPUSampling/PepTest program is done and main() is
      returning, i.e., no System.exit() call. The JVM DestroyJavaVM
      thread has called before_exit() and is waiting for the VMThread
      to exit. The VMThread is trying to execute a safepoint. A
      CompilerThread is trying alloc memory and receives SIGPROF.
      This CompilerThread has been marked with "callback". VMThread
      is in SafepointSynchronize::begin() in the 'while
      (_waiting_to_block > 0)' loop waiting for the CompilerThread to
      call back.

      The SIGPROF handler calls JVM/PI GetThreadLocalStorage() and
      because of the before_exit() call, the real handler for the API
      has been replaced with a call to _block().

      Here is a stack trace snippet from the JavaThread that called
      _block():

      THREAD t@8

        [6] os::yield_all(attempts = 100), line 2055 in "os_solaris.cpp"
        [7] _block(), line 183 in "jvmpi.cpp"
        [8] profhandler(sig = 29, siginfo = 0xd9feeab0, ucontext = 0xd9fee8b0), line 1
      31 in "b4757672.c"
        [9] __sighndlr(0x1d, 0xd9feeab0, 0xd9fee8b0, 0xdc971008), at 0xdfb92963
        [10] call_user_handler(0x1d, 0xd9feeab0, 0xd9fee8b0), at 0xdfb8e0b6
        [11] sigacthandler(), at 0xdfb8e1e0
        ---- called from signal handler with signal 29 (SIGPROF) ------
        [12] CodeHeap::verify(this = 0x8067820), line 421 in "heap.cpp"
        [13] CodeHeap::allocate(this = 0x8067820, size = 1400U), line 133 in "heap.cpp
      "
        [14] CodeCache::allocate(size = 1400), line 126 in "codeCache.cpp"
        [15] BufferBlob::operator new(s = 48U, size = 1400U), line 209 in "codeBlob.cp
      p"
        [16] BufferBlob::create(buffer_size = 1344, name = 0xdf5d1141 "CodeBuffer cons
      tructor"), line 204 in "codeBlob.cpp"

      The complete stack trace is attached as threads.log.3978.

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: