United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6860309 TEST_BUG: Insufficient sleep time in java/lang/Runtime/exec/StreamsSurviveDestroy.java
JDK-6860309 : TEST_BUG: Insufficient sleep time in java/lang/Runtime/exec/StreamsSurviveDestroy.java

Details
Type:
Bug
Submit Date:
2009-07-14
Status:
Closed
Updated Date:
2013-12-17
Project Name:
JDK
Resolved Date:
2012-05-07
Component:
core-libs
OS:
generic
Sub-Component:
java.lang
CPU:
generic
Priority:
P5
Resolution:
Fixed
Affected Versions:
6u21,7
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:

Sub Tasks

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
EVALUATION

Fixed sleep time interval may be insufficient on 
slower machines.
                                     
2011-11-11
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());
+
                                     
2011-11-11



Hardware and Software, Engineered to Work Together