JDK-8145138 : CyclicBarrier/Basic.java failed with "3 not equal to 4"
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 9
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2015-12-10
  • Updated: 2025-03-17
  • Resolved: 2019-09-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 14
11.0.28-oracleFixed 14 b15Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
----------System.out:(8/60)----------
OK!
OK!
OK!
OK!
3 not equal to 4

Passed = 310, failed = 1

----------System.err:(27/1370)----------
Stack trace
	at java.lang.Thread.dumpStack(Thread.java:1334)
	at Basic.fail(Basic.java:414)
	at Basic.fail(Basic.java:415)
	at Basic.equal(Basic.java:420)
	at Basic.testInterrupts(Basic.java:403)
	at Basic.realMain(Basic.java:287)
	at Basic.main(Basic.java:422)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:520)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:92)
	at java.lang.Thread.run(Thread.java:747)
java.lang.AssertionError: Some tests failed
	at Basic.main(Basic.java:424)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:520)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:92)
	at java.lang.Thread.run(Thread.java:747)

JavaTest Message: Test threw exception: java.lang.AssertionError: Some tests failed
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.AssertionError: Some tests failed

Comments
URL: https://hg.openjdk.java.net/jdk/jdk/rev/6a556bcd94fc User: martin Date: 2019-09-14 18:29:22 +0000
14-09-2019

Recent implementation changes in j.u.c.locks has made this very rare failure somewhat less rare, and further investigation suggests the test needs to be fixed. The incorrect assumption was: Thread A interrupts Thread B, then counts down a CountDownLatch. Thread B awaits on the CountDownLatch. It is not guaranteed that B throws InterruptedException, even though responding to interrupt is favored over responding to the release of the synchronizer.
03-08-2019

Right, checking for release and checking for interrupt cannot be done atomically at once. So even with preference orders, an unexceptional return after a release check may occur when interrupted. This has always been the case, but was rarer because of slightly shorter race window. The test could be changed to account for this in Awaiter.interruptBit:: boolean interruptBit() { return this.interrupted || isInterrupted() ; } jtreg CountDownLatch/Basic may have a similar issue?
03-08-2019

ILW (medium, low, high : reduced coverage, not repeatable, no workaround)=P4
10-12-2015

http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/49bc2b443eca/test/java/util/concurrent/CyclicBarrier/Basic.java
10-12-2015