StampedLock serializes readers on writer unlock

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 8
    • Affects Version/s: 8
    • Component/s: core-libs
    • None
    • Environment:

      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

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

              Created:
              Updated:
              Resolved: