public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "debian-gcc at lists dot debian dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug java/14709] New: gcj fails to wait for its child processes on exec()
Date: Wed, 24 Mar 2004 06:33:00 -0000	[thread overview]
Message-ID: <20040324063256.14709.debian-gcc@lists.debian.org> (raw)

[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


             reply	other threads:[~2004-03-24  6:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-24  6:33 debian-gcc at lists dot debian dot org [this message]
2004-03-24  6:39 ` [Bug java/14709] " pinskia at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040324063256.14709.debian-gcc@lists.debian.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).