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

StampedLock serializes readers on writer unlock

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 8
    • 8
    • core-libs
    • None
    • JDK 8b102, Linux x86_64

    • 8
    • b106
    • generic
    • generic
    • Verified

      Originally found by Dr. Heinz Kabutz and Victor Grazi.

      The issue is within the StampedLock code where the lock signals only the single reader while unlocking the writer. This leads to performance issues (e.g. blocked readers unblock one-by-one, in effectively serializing fashion), and also correctness (e.g. if code assumes readers are not serialized, for example, waiting on the CyclicBarrier).

      The attached test case reproduces the problem. The problem is fixed by Doug Lea in JSR 166 CVS:
      http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/main/java/util/concurrent/locks/StampedLock.java?r1=1.22&r2=1.23

            shade Aleksey Shipilev
            shade Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: