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

ReentrantReadWriteLock can't enter into 'read' lock with no 'write' locks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P3 P3
    • 9
    • 8, 9
    • hotspot
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      Windows:
      JRE 1.8.0_60-b27 / JVM 64-Bit Server 25.60-b23, mixed mode
      JRE 1.7.0_80-b15 / JVM 64-Bit Server 24.80-b11, mixed mode

      Debian:
      JRE 1.7.0_72-b14 / JVM 64-Bit Server VM 24.72-b04, mixed mode

      FULL OS VERSION :
      Microsoft Windows [Version 6.1.7601]
      Debian 3.2.60-1+deb7u3 x86_64

      A DESCRIPTION OF THE PROBLEM :
      I've got exactly the same problem and behaviour as already described in https://bugs.openjdk.java.net/browse/JDK-7191630 (ReentrantReadWriteLock in inconsistent state), but ...
      - I can't comment there
      - It is reproducible in current/latest versions of JRE (Java7 & Java8)
      - It is easily reproducible on my product - dead lock appears in around 2-3 minutes after starting a load test.

      Visual VM generates 2-3 thread dumps like this one
         java.lang.Thread.State: WAITING (parking)
          at sun.misc.Unsafe.park(Native Method)
          - parking to wait for <0x000000066f3336d8> (a java.util.concurrent.locks.ReentrantReadWriteLock$FairSync)
      ...
          at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java:731)

      Nothing is holding lock on 0x000000066f3336d8


      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I do not know how to reproduce it outside of my product

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I expect ReentrantReadWriteLock to enter into 'read' locks when there are no active 'write' lock. In my condition, when process is paused in debugger I see that "ReentrantReadWriteLock.sync.exclusiveOwnerThread" is null, but nothing can enter into that lock (neither read nor write). Also, thread dump does not show holds on problemous lock.
      REPRODUCIBILITY :
      This bug can be reproduced often.

      CUSTOMER SUBMITTED WORKAROUND :
      I've tried:
      - latest versions of JDK
      - using -XX:+UseMembar recommended on some forums
      - Fair/Unfair ReentrantReadWriteLocks

      Nothing helps.

            dholmes David Holmes
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: