JDK-6501089 : (so) test/java/nio/channels/SocketChannel/AsyncCloseChannel.java failing (timeout) on Linux
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2006-12-05
  • Updated: 2010-04-02
  • Resolved: 2008-06-26
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 Other
7 b30Fixed OpenJDK6Fixed
Related Reports
Relates :  
Description
test/java/nio/channels/SocketChannel/AsyncCloseChannel.java failing (timeout) on Linux

Here is the AsyncCloseChannel.jtr file:

#Test Results (version 2)
#Tue Dec 05 15:23:59 PST 2006
#checksum:21f756ed8db913b
#-----testdescription-----
$file=/v/tbell/b03b/j2se/test/java/nio/channels/SocketChannel/AsyncCloseChannel.java
$root=/v/tbell/b03b/j2se/test
author=Xueming Shen
keywords=bug6285901
run=ASSUMED_ACTION main AsyncCloseChannel\n
source=AsyncCloseChannel.java
title=Check no data is written to wrong socket channel during async closing.

#-----environment-----

#-----testresult-----
description=file:///v/tbell/b03b/j2se/test/java/nio/channels/SocketChannel/AsyncCloseChannel.java
end=Tue Dec 05 15:23:59 PST 2006
environment=regtest
execStatus=Failed. Execution failed: Program `/java/re/jdk/7/nightly/binaries/linux-i586/latest/bin/java' interrupted! (timed out?)
javatestOS=Linux 2.4.9-e.24 (i386)
javatestVersion=2.1.5
script=com.sun.javatest.regtest.RegressionScript 
sections=script_messages build compile main
start=Tue Dec 05 15:21:56 PST 2006
status=Failed. Execution failed: Program `/java/re/jdk/7/nightly/binaries/linux-i586/latest/bin/java' interrupted! (timed out?)
test=java/nio/channels/SocketChannel/AsyncCloseChannel.java
work=/v/tbell/b03b/j2se/test/java/nio/channels/SocketChannel/JTwork/java/nio/channels/SocketChannel

#section:script_messages
----------messages:(5/243)----------
JDK under test: (/java/re/jdk/7/nightly/binaries/linux-i586/latest)
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b04)
Java HotSpot(TM) Client VM (build 1.7.0-ea-b04, mixed mode)
Timeout signalled after 120.0 seconds

#section:build
----------messages:(3/103)----------
command: build AsyncCloseChannel 
reason: Named class compiled on demand
elapsed time (seconds): 2.951
result: Passed. Compilation successful

#section:compile
----------messages:(3/176)----------
command: compile /v/tbell/b03b/j2se/test/java/nio/channels/SocketChannel/AsyncCloseChannel.java 
reason: .class file out of date or does not exist
elapsed time (seconds): 2.95
----------System.out:(0/0)----------
----------System.err:(0/0)----------
result: Passed. Compilation successful

#section:main
----------messages:(3/135)----------
command: main AsyncCloseChannel
reason: Assumed action based on file name: run main AsyncCloseChannel 
elapsed time (seconds): 120.016
----------System.out:(0/0)----------
----------System.err:(0/0)----------
result: Failed. Execution failed: Program `/java/re/jdk/7/nightly/binaries/linux-i586/latest/bin/java' interrupted! (timed out?)


test result: Failed. Execution failed: Program `/java/re/jdk/7/nightly/binaries/linux-i586/latest/bin/java' interrupted! (timed out?)

Comments
SUGGESTED FIX --- AsyncCloseChannel.java Tue May 27 16:54:07 2008 *************** *** 142,151 **** try { s = new Socket(); synchronized(this) { ! while(!wake) { try { wait(); ! } catch (InterruptedException ex) { } } } wake = false; --- 142,151 ---- try { s = new Socket(); synchronized(this) { ! while(!wake && keepGoing) { try { wait(); ! } catch (InterruptedException ex) {} } } wake = false;
27-05-2008

EVALUATION It appears we also have a race condition in the "exit" code of SensorClient class, the "keepGoing", "wake" variables and the wait() in a while(wake) loop are definitely asking for trouble.
27-05-2008

EVALUATION Obviously the default 2 minutes timeout is too small for the 1000 iteration. It takes around 3 minutes to finish on my sparce machine, might takes longer or less on a linux machine. Given the fact that the test case fails in less than 10 "accept" iterations when running against the build without the fix (jdk6 beta), it's reasonble to consider to cut the run to 100 or something.
27-05-2008