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

finalizer deadlocks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.1.6
    • hotspot
    • sparc
    • solaris_2.6



      Name: clC74495 Date: 12/09/98


      I ran into this problem running the RSA Jsafe code which
      creates a thread and counts 'yields' over a fixed time
      interval to generate random numbers.

      The finalizer thread sets the variable inBeingFinalized
      to itself and then exits the FINALME lock. At this point
      another thread of higher priority in the system wants
      this lock so we preempt (YIELD).

      The Thread that now has the finalizer lock blocks in a synchronous
      call to run finalization from the gc. This happens because
      we need to synchornously call the gc during a heap allocation
      failure. We wait on a condition variable. This thread is
      trying to allocaton an Exception object to kill a thread
      (Thread.stop)

      At this point, all that is left to run in the JVM is a
      "spinner" thread that is in a while (1) Thread.yield() loop

      The finalizer never gets to run again, and the system is
      hung because the spinner thread would normally get killed
      by the second thread which is blocked waiting for the finalizer
      to run.

      In a system that honors real thread priorities, the spinner
      thread will continue to run forever and the finalizer thread
      will never run.
      (Review ID: 47617)
      ======================================================================

            mr Mark Reinhold
            clucasius Carlos Lucasius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: