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

possible deadlock between class loading lock and asynchronous finalization

XMLWordPrintable

    • 1.2alpha2
    • sparc
    • solaris_2.5
    • 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
              java.lang.Thread.run(Thread.java)
          "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
              java.lang.Object.wait(Object.java)
              java.awt.EventQueue.getNextEvent(EventQueue.java:113)
              java.awt.EventDispatchThread.run(EventDispatchThread.java:55)
          "Thread-3" (TID:0xee304ea8, sys_thread_t:0xef271de0, state:CW) prio=10
              sun.server.util.AlarmManager.getNextAlarm(AlarmManager.java:148)
              sun.server.util.AlarmManager.run(AlarmManager.java:77)
              java.lang.Thread.run(Thread.java)
          "Logging Alarm Manager" (TID:0xee304900, sys_thread_t:0xef2a1de0, state:CW) prio=5
              java.lang.Object.wait(Object.java)
              sun.server.util.AlarmManager.getNextAlarm(AlarmManager.java:137)
              sun.server.util.AlarmManager.run(AlarmManager.java:77)
              java.lang.Thread.run(Thread.java)
          "Finalizer thread" (TID:0xee3001d8, sys_thread_t:0xef2f1de0, state:MW) prio=1
              sun.awt.motif.X11Graphics.finalize(X11Graphics.java:102)
          "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
              java.security.Security.getImpl(Security.java)
              java.security.Signature.getInstance(Signature.java:180)
              sun.security.x509.X509Cert.verify(X509Cert.java:352)
              sun.security.ssl.CertChain.validateSig(CertChain.java:185)
              sun.security.ssl.CertChain.checkChain(CertChain.java:165)
              sun.security.ssl.CertChain.<init>(CertChain.java:59)
              sun.security.ssl.SSLEndpoint.getServerSocket(SSLEndpoint.java:141)
              sun.server.ConnectionEndpoint.getServerSocket(ConnectionEndpoint.java:88)
              sun.server.Service.bindSocket(Service.java:175)
              sun.server.ServerProcess.startServices(ServerProcess.java:351)
              sun.server.ServerProcess.main(ServerProcess.java:167)
      Monitor Cache Dump:
          sun.server.util.AlarmManager@EE304EA0/EE355650: <unowned>
              Waiting to be notified:
                  "Thread-3"
          java.awt.EventQueue@EE324C10/EE3DA4E0: <unowned>
              Waiting to be notified:
                  "AWT-EventQueue-0"
          sun.awt.motif.MToolkit@EE324BE0/EE3DA3F0: <unowned>
              Waiting to be notified:
                  "AWT-Motif"
          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:
                  "main"
          Monitor IO lock: <unowned>
          Child death monitor: <unowned>
          Event monitor: <unowned>
          I/O monitor: <unowned>
              Waiting to be notified:
                  "AWT-Input"
          Alarm monitor: <unowned>
              Waiting to be notified:
                  "Clock"
          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]

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: