This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/14709] New: gcj fails to wait for its child processes on exec()
- From: "debian-gcc at lists dot debian dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Mar 2004 06:32:59 -0000
- Subject: [Bug java/14709] New: gcj fails to wait for its child processes on exec()
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
[forwarded from http://bugs.debian.org/238432]
When calling Runtime.getRuntime.exec(String) in program that has been
compiled with gcj-3.3.3, process is created and works as expected, but
process is not reaped. With Sun JVM 1.5.0-beta the same programs work
fine.
We tested this also with gcc-3.4 CVS 20040314-1, with same results.
Steps to reproduce:
1) Write a program that calls Runtime.getRuntime.exec("uptime"),
opens and closes both input and output stream and calls destroy()
to process (or use the one I attach when this report hits the web)
and that continues to run.
2) See process listing: the processes created by exec() show there
as <defunct>.
import java.io.*;
/**
* This program demonstrates bug in gcj Runtime.exec().
*
* @author Jari Juslin, zds@iki.fi
*
* @version $Revision$
*/
public class GcjExecBugDemo {
/* **************************************************************** */
void run() {
Process uptimeProcess;
Reader stdoutReader;
while (true) {
try {
uptimeProcess = Runtime.getRuntime().exec("uptime");
// Just to make sure that bug is not in not opening
// input to process.
uptimeProcess.getOutputStream().close();
stdoutReader = new
InputStreamReader(uptimeProcess.getInputStream());
while (stdoutReader.read() != -1)
;
stdoutReader.close();
uptimeProcess.destroy();
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
} catch (IOException e) {
System.out.println("IOException: " +
e.getMessage());
try {
Thread.sleep(2000);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
}
/* **************************************************************** */
public static void main(String[] args) {
GcjExecBugDemo gcjExecBugDemo;
gcjExecBugDemo = new GcjExecBugDemo();
gcjExecBugDemo.run();
}
}
--
Summary: gcj fails to wait for its child processes on exec()
Product: gcc
Version: 3.3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: debian-gcc at lists dot debian dot org
CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu
dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14709