JDK-6963841 : java/util/concurrent/Phaser/Basic.java fails intermittently
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-06-24
  • Updated: 2013-12-17
  • Resolved: 2012-05-07
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 7 JDK 8
7u21Fixed 8 b34Fixed
Related Reports
Relates :  
Description
The test failed once in JPRT. The build used is essentially jdk7-b100.

--------------------------------------------------
TEST: java/util/concurrent/Phaser/Basic.java
JDK under test: (C:\temp\jprt\T1\T\072215~1.AB2\TESTPR~1\WINDOW~1.0-P)
java version "1.7.0-201006240722.ab23780.jdk"
Java(TM) SE Runtime Environment (build 1.7.0-201006240722.ab23780.jdk-jprtadm_2010_06_24_00_52-b00)
Java HotSpot(TM) Client VM (build 19.0-b02, mixed mode, sharing)


ACTION: build -- Passed. Build successful
REASON: Named class compiled on demand
TIME:   0.094 seconds
messages:
command: build Basic
reason: Named class compiled on demand
elapsed time (seconds): 0.094

ACTION: compile -- Passed. Compilation successful
REASON: .class file out of date or does not exist
TIME:   0.094 seconds
messages:
command: compile C:\temp\jprt\T1\T\072215.ab23780\source\test\java\util\concurrent\Phaser\Basic.java
reason: .class file out of date or does not exist
elapsed time (seconds): 0.094

ACTION: main -- Failed. Execution failed: `main' threw exception: java.lang.AssertionError: Some tests failed
REASON: Assumed action based on file name: run main Basic 
TIME:   20.062 seconds
messages:
command: main Basic
reason: Assumed action based on file name: run main Basic 
elapsed time (seconds): 20.062
STDOUT:
Mismatch in thread InterruptibleWaiter:23: java.util.concurrent.TimeoutException, java.lang.InterruptedException

Passed = 503, failed = 1

STDERR:
java.lang.Exception: Stack trace
	at java.lang.Thread.dumpStack(Thread.java:1353)
	at Basic.fail(Basic.java:396)
	at Basic.fail(Basic.java:397)
	at Basic.checkResult(Basic.java:75)
	at Basic.realMain(Basic.java:261)
	at Basic.main(Basic.java:404)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:680)
	at java.lang.Thread.run(Thread.java:717)
java.lang.AssertionError: Some tests failed
	at Basic.main(Basic.java:406)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:680)
	at java.lang.Thread.run(Thread.java:717)

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


TEST RESULT: Failed. Execution failed: `main' threw exception: java.lang.AssertionError: Some tests failed
--------------------------------------------------

Comments
EVALUATION I think I found the actual cause for this failure. Though, the increased defensive timeouts are still a good idea. There is a race in the test itself. The "One thread interrupted" test tries to interrupt a thread blocked in awaitAdvanceInterruptibly, but how do we know the thread has actually made it to this point before we interrupt? The solution is to delay the main thread before interrupting the thread that should be blocked in awaitAdvanceInterruptibly. JDK8 Changeset: 85b7fcf14249 Author: chegar Date: 2012-04-04 15:14 +0100 URL: http://hg.openjdk.java.net/jdk8/tl/jdk/rev/85b7fcf14249 6963841: java/util/concurrent/Phaser/Basic.java fails intermittently Reviewed-by: dl, dholmes ! test/java/util/concurrent/Phaser/Basic.java
04-04-2012

EVALUATION It is certainly strange that 10 seconds would not be a sufficient amount of time for the awaiter to wait before timing out. This machine must be really really slow or have a lot going on. I guess the best course of action is to increase the timeout.
13-07-2010