JDK-7131522 : Runtime.getRuntime().exec() and ProcessBuilder.start() cause parent JVM to exit
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_7
  • CPU: x86
  • Submitted: 2012-01-19
  • Updated: 2012-03-20
  • Resolved: 2012-01-19
Description
FULL PRODUCT VERSION :
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Windows 7 Enterprise Edition, 64-bit

A DESCRIPTION OF THE PROBLEM :
Runtime.getRuntime().exec() and ProcessBuilder.start() causes the calling JVM to exit silently.  The child process is never spawned.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
First off - the problem occurs in version 1.7.0_01.  The version mentioned above is the version that the problem disappears in the following code:

System.err.println("##### creating ProcessBuilder ...");
ProcessBuilder pb = new ProcessBuilder();

System.err.println("##### setting command line args ...");
pb.command("java","-jar","some-executable-jar.jar");

System.err.print("##### starting ProcessBuilder: ");
for(String opt : pb.command()) System.err.print(opt+" ");
System.err.println();

pb.start();
System.err.println("##### Process started, exiting host process ...");
System.exit(0);

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The child process is supposed to display a new JFrame, so I would expect that to happen shortly after seeing the last "...exiting host process ..." print statement to appear on the host process' console.
ACTUAL -
I see all by the final print statement get printed to the console, then the parent JVM dies.  As far as I can tell, the child process never gets started.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
There is no error message.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
System.err.println("##### creating ProcessBuilder ...");
ProcessBuilder pb = new ProcessBuilder();

System.err.println("##### setting command line args ...");
pb.command("java","-jar","some-executable-jar.jar");

System.err.print("##### starting ProcessBuilder: ");
for(String opt : pb.command()) System.err.print(opt+" ");
System.err.println();

pb.start();
System.err.println("##### Process started, exiting host process ...");
System.exit(0);
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Updating to Java 1.7.0_02 seems to have fixed the problem.