public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue()
@ 2003-08-05 5:04 bryce at mckinlay dot net dot nz
2003-08-05 5:21 ` [Bug libgcj/11801] " pinskia at physics dot uc dot edu
` (7 more replies)
0 siblings, 8 replies; 14+ messages in thread
From: bryce at mckinlay dot net dot nz @ 2003-08-05 5:04 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
Summary: Problems with Process.waitFor() and exitValue()
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libgcj
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bryce at mckinlay dot net dot nz
CC: gcc-bugs at gcc dot gnu dot org
There are some bugs with libgcj's POSIX Runtime.exec implementation.
Problem #1: Process.exitValue() only returns the processes exit code if waitFor() has already been
called, because only waitFor() ever calls waitpid.
Problem #2: Process.waitFor() and Process.exitValue() do not work if they are called from a thread
other than the thread which called Runtime.exec(). This seems to be because the pid created in
Runtime.exec() is only considered a child of the thread which created it.
Currently the problem can be hidden in some cases because Process.waitFor() will actually return 0
if waitpid returns an error other than EINTR.
Possible solution: SIGCHLD handler?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
2003-08-05 5:04 [Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue() bryce at mckinlay dot net dot nz
@ 2003-08-05 5:21 ` pinskia at physics dot uc dot edu
2003-08-05 5:51 ` bryce at mckinlay dot net dot nz
` (6 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-05 5:21 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
pinskia at physics dot uc dot edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2003-08-05 05:21:48
date| |
------- Additional Comments From pinskia at physics dot uc dot edu 2003-08-05 05:21 -------
I can confirm Problem 1.
Problem 2 sounds more like a Linux (Linux Threads or otherwise, glibc) problem rather than a
libgcj problem as it will work fine on Darwin as threads are not processes in Darwin.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
2003-08-05 5:04 [Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue() bryce at mckinlay dot net dot nz
2003-08-05 5:21 ` [Bug libgcj/11801] " pinskia at physics dot uc dot edu
@ 2003-08-05 5:51 ` bryce at mckinlay dot net dot nz
2003-08-23 1:09 ` dhazeghi at yahoo dot com
` (5 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: bryce at mckinlay dot net dot nz @ 2003-08-05 5:51 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
------- Additional Comments From bryce at mckinlay dot net dot nz 2003-08-05 05:51 -------
Yes, it is presumably due to linux's 1:1 thread->pid mapping. I guess that POSIX does not specify
how waitpid() should interact with threads, in which case it isn't a bug in linuxthreads. In any case,
the JRE works correctly on the same system, so its something that needs to be fixed in libgcj.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
2003-08-05 5:04 [Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue() bryce at mckinlay dot net dot nz
2003-08-05 5:21 ` [Bug libgcj/11801] " pinskia at physics dot uc dot edu
2003-08-05 5:51 ` bryce at mckinlay dot net dot nz
@ 2003-08-23 1:09 ` dhazeghi at yahoo dot com
2003-09-28 20:39 ` tromey at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: dhazeghi at yahoo dot com @ 2003-08-23 1:09 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
dhazeghi at yahoo dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4 |---
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
2003-08-05 5:04 [Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue() bryce at mckinlay dot net dot nz
` (2 preceding siblings ...)
2003-08-23 1:09 ` dhazeghi at yahoo dot com
@ 2003-09-28 20:39 ` tromey at gcc dot gnu dot org
2003-11-08 1:29 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: tromey at gcc dot gnu dot org @ 2003-09-28 20:39 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
------- Additional Comments From tromey at gcc dot gnu dot org 2003-09-28 19:10 -------
I recently discovered that if your program does not call
waitFor() on a process, it will remain as a zombie.
This is predictable, of course, since only waitFor() calls wait
to reap the child. However, this is a difference from the
JDK, and thus arguably a bug.
I'm not too concerned about LinuxThreads problems; the world
is moving to NPTL...
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
2003-08-05 5:04 [Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue() bryce at mckinlay dot net dot nz
` (3 preceding siblings ...)
2003-09-28 20:39 ` tromey at gcc dot gnu dot org
@ 2003-11-08 1:29 ` pinskia at gcc dot gnu dot org
2003-11-08 1:38 ` daney at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-11-08 1:29 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-11-08 01:29 -------
*** Bug 12956 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |daney at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
2003-08-05 5:04 [Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue() bryce at mckinlay dot net dot nz
` (4 preceding siblings ...)
2003-11-08 1:29 ` pinskia at gcc dot gnu dot org
@ 2003-11-08 1:38 ` daney at gcc dot gnu dot org
2003-11-08 1:45 ` bryce at mckinlay dot net dot nz
2004-03-24 6:39 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 14+ messages in thread
From: daney at gcc dot gnu dot org @ 2003-11-08 1:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From daney at gcc dot gnu dot org 2003-11-08 01:38 -------
The way to solve the problem on non-NPTL linux systems is to create a thread
that is dedicated to forking and waiting for all execed processes. This is the
approach that Sun's runtime uses.
--
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2003-08-05 05:21:48 |2003-11-08 01:38:31
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
2003-08-05 5:04 [Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue() bryce at mckinlay dot net dot nz
` (5 preceding siblings ...)
2003-11-08 1:38 ` daney at gcc dot gnu dot org
@ 2003-11-08 1:45 ` bryce at mckinlay dot net dot nz
2004-03-24 6:39 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 14+ messages in thread
From: bryce at mckinlay dot net dot nz @ 2003-11-08 1:45 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bryce at mckinlay dot net dot nz 2003-11-08 01:45 -------
That sounds like the right approach. We could possibly simplify a lot of a lot of natPosixProcess.cc
by doing this.
A related bug I noticed recently is that Process.destroy() leaves a zombie, because it also doesnt
call waitpid().
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
2003-08-05 5:04 [Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue() bryce at mckinlay dot net dot nz
` (6 preceding siblings ...)
2003-11-08 1:45 ` bryce at mckinlay dot net dot nz
@ 2004-03-24 6:39 ` pinskia at gcc dot gnu dot org
7 siblings, 0 replies; 14+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-03-24 6:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-03-24 06:39 -------
*** Bug 14709 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |debian-gcc at lists dot
| |debian dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
[not found] <20030805050422.11801.mckinlay@redhat.com>
` (3 preceding siblings ...)
2004-08-12 16:28 ` daney at gcc dot gnu dot org
@ 2004-08-12 17:51 ` mckinlay at redhat dot com
4 siblings, 0 replies; 14+ messages in thread
From: mckinlay at redhat dot com @ 2004-08-12 17:51 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |3.5.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
[not found] <20030805050422.11801.mckinlay@redhat.com>
` (2 preceding siblings ...)
2004-08-12 16:20 ` cvs-commit at gcc dot gnu dot org
@ 2004-08-12 16:28 ` daney at gcc dot gnu dot org
2004-08-12 17:51 ` mckinlay at redhat dot com
4 siblings, 0 replies; 14+ messages in thread
From: daney at gcc dot gnu dot org @ 2004-08-12 16:28 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From daney at gcc dot gnu dot org 2004-08-12 16:28 -------
Fixed by the patch.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
[not found] <20030805050422.11801.mckinlay@redhat.com>
2004-07-09 20:21 ` mckinlay at redhat dot com
2004-07-27 18:28 ` daney at gcc dot gnu dot org
@ 2004-08-12 16:20 ` cvs-commit at gcc dot gnu dot org
2004-08-12 16:28 ` daney at gcc dot gnu dot org
2004-08-12 17:51 ` mckinlay at redhat dot com
4 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-08-12 16:20 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-08-12 16:20 -------
Subject: Bug 11801
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: daney@gcc.gnu.org 2004-08-12 16:20:12
Modified files:
libjava : Makefile.am Makefile.in configure configure.in
posix-threads.cc
libjava/gcj : Makefile.in javaprims.h
libjava/include: Makefile.in config.h.in
libjava/java/lang: PosixProcess.java Runtime.java
natPosixProcess.cc
libjava/testsuite: Makefile.in
Log message:
2004-08-12 David Daney <ddaney@avtrex.com>
PR libgcj/11801
* java/lang/PosixProcess.java: Rewrote.
* java/lang/natPosixProcess.cc: Rewrote.
* java/lang/Runtime.java (execInternal): Declare throws IOException.
* gcj/javaprims.h (ConcreteProcess$ProcessManager): Declare.
* posix-threads.cc (block_sigchld) New function.
(_Jv_ThreadRegister) Use it.
(_Jv_ThreadStart) Use it.
* configure.in (PLATFORM_INNER_NAT_HDRS): New AC_SUBST() used in...
* Makefile.am: ... to specify extra native headers.
* configure: Regenerated.
* include/config.h: Regenerated.
* Makefile.in: Regenerated.
* gcj/Makefile.in: Regenerated.
* include/Makefile.in: Regenerated.
* testsuite/Makefile.in: Regenerated.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/Makefile.am.diff?cvsroot=gcc&r1=1.398&r2=1.399
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/Makefile.in.diff?cvsroot=gcc&r1=1.424&r2=1.425
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/configure.diff?cvsroot=gcc&r1=1.225&r2=1.226
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/configure.in.diff?cvsroot=gcc&r1=1.203&r2=1.204
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/posix-threads.cc.diff?cvsroot=gcc&r1=1.34&r2=1.35
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gcj/Makefile.in.diff?cvsroot=gcc&r1=1.50&r2=1.51
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/gcj/javaprims.h.diff?cvsroot=gcc&r1=1.51&r2=1.52
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/Makefile.in.diff?cvsroot=gcc&r1=1.51&r2=1.52
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/include/config.h.in.diff?cvsroot=gcc&r1=1.52&r2=1.53
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/PosixProcess.java.diff?cvsroot=gcc&r1=1.5&r2=1.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/Runtime.java.diff?cvsroot=gcc&r1=1.15&r2=1.16
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/lang/natPosixProcess.cc.diff?cvsroot=gcc&r1=1.18&r2=1.19
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/testsuite/Makefile.in.diff?cvsroot=gcc&r1=1.61&r2=1.62
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
[not found] <20030805050422.11801.mckinlay@redhat.com>
2004-07-09 20:21 ` mckinlay at redhat dot com
@ 2004-07-27 18:28 ` daney at gcc dot gnu dot org
2004-08-12 16:20 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: daney at gcc dot gnu dot org @ 2004-07-27 18:28 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Last reconfirmed|2004-06-25 23:20:06 |2004-07-27 18:28:07
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug libgcj/11801] Problems with Process.waitFor() and exitValue()
[not found] <20030805050422.11801.mckinlay@redhat.com>
@ 2004-07-09 20:21 ` mckinlay at redhat dot com
2004-07-27 18:28 ` daney at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 14+ messages in thread
From: mckinlay at redhat dot com @ 2004-07-09 20:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mckinlay at redhat dot com 2004-07-09 20:21 -------
Some more info in this thread:
http://gcc.gnu.org/ml/java-patches/2004-q3/msg00126.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11801
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2004-08-12 17:51 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-05 5:04 [Bug libgcj/11801] New: Problems with Process.waitFor() and exitValue() bryce at mckinlay dot net dot nz
2003-08-05 5:21 ` [Bug libgcj/11801] " pinskia at physics dot uc dot edu
2003-08-05 5:51 ` bryce at mckinlay dot net dot nz
2003-08-23 1:09 ` dhazeghi at yahoo dot com
2003-09-28 20:39 ` tromey at gcc dot gnu dot org
2003-11-08 1:29 ` pinskia at gcc dot gnu dot org
2003-11-08 1:38 ` daney at gcc dot gnu dot org
2003-11-08 1:45 ` bryce at mckinlay dot net dot nz
2004-03-24 6:39 ` pinskia at gcc dot gnu dot org
[not found] <20030805050422.11801.mckinlay@redhat.com>
2004-07-09 20:21 ` mckinlay at redhat dot com
2004-07-27 18:28 ` daney at gcc dot gnu dot org
2004-08-12 16:20 ` cvs-commit at gcc dot gnu dot org
2004-08-12 16:28 ` daney at gcc dot gnu dot org
2004-08-12 17:51 ` mckinlay at redhat dot com
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).