-
Bug
-
Resolution: Fixed
-
P2
-
8
-
None
-
JDK 8b102, Linux x86_64
-
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
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