RFR JDK-8031554: com/sun/tools/attach/BasicTests.java fails intermittently

shanliang shanliang.jiang at oracle.com
Thu Jun 26 13:15:47 UTC 2014


Hi,

Today ProcessTools.executeProcess has the code:
     new OutputAnalyzer(pb.start());

and OutputAnalyzer constructor calls immediately:
     exitValue = process.exitValue();

the test got exception because the process did not end.

So a direct solution for the test is not to call:
        ProcessTools.executeTestJvm(args);

but:
         ProcessBuilder pb = 
ProcessTools.createJavaProcessBuilder(Utils.addTestJavaOpts(args));
         Process process = pb.start();
         process.waitFor();
         OutputAnalyzer output = new OutputAnalyzer(process);

here we do waiting:
         process.waitFor();
before constructing an OutputAnalyzer.

ProcessTools is a tool class we may have same issue for other tests 
using this class. So we may need to improve the test library.

bug: https://bugs.openjdk.java.net/browse/JDK-8031554
webrev: http://cr.openjdk.java.net/~sjiang/JDK-8031554/00/


Thanks,
Shanliang



More information about the serviceability-dev mailing list