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.
7u21Fixed 8 b15Fixed
In the test 


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

  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.

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()); +

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