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

java.util.concurrent.locks.Condition.await(timeout, units) hangs forever

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P4
    • None
    • 6u10
    • core-libs

    Description

      FULL PRODUCT VERSION :
      java version "1.6.0_12"
      Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
      Java HotSpot(TM) Server VM (build 11.2-b01, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      SunOS x2001 5.10 Generic_127128-11 i86pc i386 i86pc

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      Solaris 10, AMD Opteron 2356 (2 CPU quad-core 2312 MHz)

      A DESCRIPTION OF THE PROBLEM :
      during an execution of
      java.util.concurrent.locks.Condition.await(timeout,
      TimeUnit.MILLISECONDS) a thread hangs on Solaris/AMD x64 instead of being resumed after timeout is gone.

      The environment is:
      Java 1.6.0_12
      Solaris 10
      AMD Opteron 2356 2 CPU x Quad-Core 2312 MHz

      The bug is NOT reproduced on the platforms:
      Solaris / UltraSPARC T1
      Solaris / UltraSPARC T2+
      Solaris / UltraSPARC IV+
      Linux / Xeon


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached test application on Solaris/AMD x64 platform.
      In 2-20 minutes the bug should be reproduced with the message "JVM Bug found in 8 threads !!!!" in the log

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      after inocation of java.util.concurrent.locks.Condition.await(timeout,
      TimeUnit.MILLISECONDS) a thread should resume
      ACTUAL -
      a thread hangs forever on java.util.concurrent.locks.Condition.await(timeout,
      TimeUnit.MILLISECONDS)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      // one thread:

                              lock.lock();
                              try {
                                  try {
                                      while (queueSize == 0) {
                                          if (condition.await(AWAIT, TimeUnit.MILLISECONDS)) {
                                              conditionCount++;
                                          }
                                      }
                                      awaitCount++;
                                  } catch (InterruptedException e) {
                                      e.printStackTrace();
                                  }
                              } finally {
                                  lock.unlock();
                              }

      // another thread:

                  lock.lock();
                  try {
                      bufferPos = (int) (eventsCount % LONG_DATA_COUNT);
                      if (queueSize == 0 && Math.random() > SIGNAL_PROBABILITY) {
                          condition.signal();
                      }
                      eventsCount++;
                      queueSize++;
                  } finally {
                      lock.unlock();
                  }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      there is no workaround

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: