JDK-6860309 : TEST_BUG: Insufficient sleep time in java/lang/Runtime/exec/StreamsSurviveDestroy.java
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 6u21,7
  • Priority: P5
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2009-07-14
  • 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 b15Fixed
Description
In the test 

java/lang/Runtime/exec/StreamsSurviveDestroy.java

Thread.sleep(100) is insufficient on slow sparc machines in -Xcomp mode. For instance, on vm-b1600s-1.sfbay the test fails like this (a couple of attempts might be needed to reproduce):

/net/sqenfs-1.sfbay/export1/comp/vm/jdk/hsx/16/pit/b06/jdk7b65/product/solaris-sparcv9/bin/java -d64 -server -Xcomp -XX:-PrintVMOptions StreamsSurviveDestroy

test
  EOF
  exit: 15
Exception in thread "main" java.lang.Exception: out: Exception thrown
        at StreamsSurviveDestroy$Copier.check(StreamsSurviveDestroy.java:93)
        at StreamsSurviveDestroy.test(StreamsSurviveDestroy.java:109)
        at StreamsSurviveDestroy.main(StreamsSurviveDestroy.java:176)
Caused by: java.io.IOException: Stream Closed
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:241)
        at java.lang.UNIXProcess$DeferredCloseInputStream.read(UNIXProcess.java:271)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
        at java.io.FilterInputStream.read(FilterInputStream.java:107)
        at StreamsSurviveDestroy$Copier.run(StreamsSurviveDestroy.java:65)

Increasing sleep time to 1000 helps.

Comments
SUGGESTED FIX At the start of each test that uses a fixed delay, add a loop until both of the test threads have actually been started before attempting the various thread interruptions. - Thread.sleep(100); + do { + Thread.sleep(100); + } while (!cp1.isAlive() && !cp2.isAlive()); +
11-11-2011

EVALUATION Fixed sleep time interval may be insufficient on slower machines.
11-11-2011