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

Linux: suspended thread blocks raw ObjectMonitor entry

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.3.1
    • 1.2.0, 1.3.1
    • vm-legacy
    • rc2
    • generic
    • linux, solaris_7
    • Not verified

        daniel.daugherty@Eng 2001-02-09

        This bug was encountered while chasing the following bug:

        4369489 2/5 jdb does not work on Linux platform.

        This bug is the second layer of that onion.

        I have a test case that exercises JVM/DI raw monitors and thread
        suspend/resume. This test case passes 6000 loops (3 worker threads in
        each loop for 1 minute of execution time on an Ultra 30) with the
        current service_baseline on Solaris SPARC, Solaris X86 and Win32.

        However, on RedHat 6.2 Linux, the test case hangs on the *first*
        iteration.

        Here is a transaction diagram of the test:

        //
        // main blocker contender resumer
        // ================= ================ =================== ================
        // launch blocker
        // <launch returns> blocker running
        // launch contender enter threadLock
        // <launch returns> wait for notify contender running
        // launch resumer : block on threadLock
        // <launch returns> : : resumer running
        // suspend contender : <suspended> wait for notify
        // <ready to test> : : :
        // : : : :
        // notify blocker exit threadLock : :
        // join blocker : : enter threadLock*
        // <join returns> blocker exits <resumed> resume contender
        // join resumer : exit threadLock
        // <join returns> enter threadLock resumer exits
        // join contender exit threadLock
        // <join returns> contender exits
        //

        On Linux, the resumer thread fails to enter threadLock even though
        there is no owner. The blocker thread has exited threadLock and the
        contender thread is suspended.

        I have added a test case that exercises JVM/PI raw monitors and thread
        suspend/resume. Initially this test case failed on all four platforms.
        But after discussing this with Karen, I changed JVM/PI SuspendThread()
        to immediately suspend threads in state _thread_in_native. With that
        fix in place, this test case passes 1900 loops (3 worker threads in
        each loop for 1 minute of execution time on an Ultra 30) with the
        current service_baseline on Solaris SPARC, Solaris X86 and Win32.

        However, on RedHat 6.2 Linux, the JVM/PI test case also hangs on the
        first iteration.

        I have added a test case that exercises Java ObjectMonitors and JVM/DI
        thread suspend/resume. Like in 4333847, this test shows that it is
        necessary for JVM/DI SuspendThread() calls to not allow pending
        ObjectMonitor.enter() calls to complete. This test case fails on all
        four platforms.

        I have added a test case that exercises Java ObjectMonitors and JVM/PI
        thread suspend/resume. Like in 4333847, this test shows that it is
        necessary for JVM/PI SuspendThread() calls to not allow pending
        ObjectMonitor.enter() calls to complete. This test case fails on all
        four platforms.

        daniel.daugherty@Eng 2001-03-23

        Just for completeness, I have added a test case that exercises Java
        ObjectMonitors and Thread.suspend() and Thread.resume(). I realize
        that Thread.suspend() and Thread.resume() are deprecated, but we need
        to make sure that bad things don't happen.

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

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: