RFR JDK-8022721 : AnnotationTypeDeadlockTest.java throws java.lang.IllegalStateException: unexpected condition
Peter Levart
peter.levart at gmail.com
Sat Aug 17 13:06:58 UTC 2013
Hi,
Please review the fix for a test that tries to provoke a deadlock when
parsing annotations:
http://cr.openjdk.java.net/~plevart/jdk8-tl/AnnotationType/fix1/webrev.01/
The test was failing on slow machines when run with -Xcomp due to a short
time out (5s). The fix makes the test only fail when the dead-lock
situation is detected - never times out. I also re-worked the dead-lock
detection so that it is more correct now (using ThreadMXBean). When run on
an old build of JDK8 (the dead-lock bug not fixed yet), it produces the
following failure:
Exception in thread "main" java.lang.IllegalStateException: deadlock
detected:
"AnnB" Id=10 BLOCKED on java.lang.Class at 5fbd8c6e owned by "AnnA" Id=9
at
sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:81)
- blocked on java.lang.Class at 5fbd8c6e
at
sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:91)
at
sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3093)
at java.lang.Class.getDeclaredAnnotations(Class.java:3081)
at
AnnotationTypeDeadlockTest$Task.run(AnnotationTypeDeadlockTest.java:68)
"AnnA" Id=9 BLOCKED on java.lang.Class at 514ae5cd owned by "AnnB" Id=10
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3090)
- blocked on java.lang.Class at 514ae5cd
at java.lang.Class.getAnnotation(Class.java:3052)
at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:131)
at
sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:84)
at
sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:222)
at
sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:88)
at
sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:70)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3093)
...
When run on new build of JDK8, it succeeds (also tried with -Xcomp).
Regards, Peter
More information about the core-libs-dev
mailing list