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

possible deadlock between class loading lock and asynchronous finalization


    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.1.1
    • Fix Version/s: 1.2.0
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
    • CPU:
    • OS:
    • Verification:
      Not verified


      I was running the Java Web Server, and it hung at one point. The VM thread and
      monitor dump at this point is below. I have been thrashing around with the Java
      Server for a couple of days, and this is the only time it happened; I wasn't
      able to reproduce it with java_g, but the conditions for making this occur may
      require rare alignments of the stars anyway. This was running using a build
      that was a child of the (frozen) JDK1.1.1 workspace.

      Looking at the thread/monitor dump, I think we can tell what happened, though.

      The asynchronous finalizer thread is executing a finalizer (that of a
      sun.awt.motif.X11Graphics object), so therefore BeingFinalized is non-NULL.
      It is blocked trying to acquire LOADCLASS (based on the line in the source
      code, trying to load the AWTFinalizer class, perhaps?)

      The main thread is holding the LOADCLASS lock, and it is waiting on FINALMEQ.
      Therefore, somewhere inside the code holding LOADCLASS, an object allocation
      failed, and manageAllocFailure is trying the synchronously run finalizers. But
      it waits to be notified on FINALMEQ as long as BeingFinalized is non-NULL,
      which it will always be, since the finalizer executing in the asynchronous
      finalizer thread is blocked forever...

      Full thread dump:
          "AWT-Motif" (TID:0xee324ca0, sys_thread_t:0xef071de0, state:CW) prio=5
          "AWT-Input" (TID:0xee324c78, sys_thread_t:0xef0a1de0, state:CW) prio=5
          "AWT-EventQueue-0" (TID:0xee324c60, sys_thread_t:0xef0d1de0, state:CW) prio=5
          "Thread-3" (TID:0xee304ea8, sys_thread_t:0xef271de0, state:CW) prio=10
          "Logging Alarm Manager" (TID:0xee304900, sys_thread_t:0xef2a1de0, state:CW) prio=5
          "Finalizer thread" (TID:0xee3001d8, sys_thread_t:0xef2f1de0, state:MW) prio=1
          "Idle thread" (TID:0xee300190, sys_thread_t:0xef3c1de0, state:R) prio=0 *current thread*
          "Clock" (TID:0xee3000d0, sys_thread_t:0xef3f1de0, state:CW) prio=12
          "main" (TID:0xee3000a8, sys_thread_t:0x45910, state:CW) prio=5
      Monitor Cache Dump:
          sun.server.util.AlarmManager@EE304EA0/EE355650: <unowned>
              Waiting to be notified:
          java.awt.EventQueue@EE324C10/EE3DA4E0: <unowned>
              Waiting to be notified:
          sun.awt.motif.MToolkit@EE324BE0/EE3DA3F0: <unowned>
              Waiting to be notified:
          java.lang.Class@EE3202E0/EE40DA78: owner "main" (0x45910, 1 entry)
          sun.server.util.AlarmManager@EE3048F8/EE3500F0: <unowned>
              Waiting to be notified:
                  "Logging Alarm Manager"
          java.lang.Class@EE325230/EE40F1D0: owner "Finalizer thread" (0xef2f1de0, 1 entry)
      Registered Monitor Dump:
          Thread queue lock: <unowned>
          Name and type hash table lock: <unowned>
          String intern lock: <unowned>
          JNI pinning lock: <unowned>
          JNI global reference lock: <unowned>
          BinClass lock: <unowned>
          Class loading lock: owner "main" (0x45910, 1 entry)
              Waiting to enter:
                  "Finalizer thread"
          Java stack lock: <unowned>
          Code rewrite lock: <unowned>
          Heap lock: <unowned>
          Has finalization queue lock: <unowned>
          Finalize me queue lock: <unowned>
              Waiting to be notified:
          Monitor IO lock: <unowned>
          Child death monitor: <unowned>
          Event monitor: <unowned>
          I/O monitor: <unowned>
              Waiting to be notified:
          Alarm monitor: <unowned>
              Waiting to be notified:
          Sbrk lock: <unowned>
          Monitor cache expansion lock: <unowned>
          Monitor registry: owner "Idle thread" (0xef3c1de0, 1 entry)
      Thread Alarm Q:
          sys_thread_t 0xef0a1de0 [Timeout in 6 ms]
          sys_thread_t 0xef271de0 [Timeout in 937 ms]


          Issue Links



              • Assignee:
                sliangsunw Sheng Liang (Inactive)
                peterjones Peter Jones
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: