Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6751021

TEST_BUG: race condition in the test java/lang/Runtime/exec/Duped.java

XMLWordPrintable

    • b130
    • generic
    • generic
    • Verified

      The test

         java/lang/Runtime/exec/Duped.java

      fails if the child process performs this check on line 43:

         (System.in.available() != 0)

      earlier than the parent process has a chance to write to the output stream (line 79).

      The failure is fairly easy to reproduce by compiling the test standalone and running it in -Xcomp mode. As the child is started in default -Xmixed mode, it runs "faster" than the parent, and the test fails in roughly one case out of 3:

      $ javac Duped.java
      $ java -Xcomp Duped
      Exception in thread "main" java.lang.Exception: Failed, read ``''
      at Duped.main(Duped.java:87)

      As we dont mind if the child blocks on the read call when there is no data available yet and this is even desirable, I think that the check on line 43 (System.in.available() != 0) is superfluos. Removing it fixes the issue.

            michaelm Michael McMahon
            sdolgovorcl Sergey Dolgov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: