You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Simon Kitching <si...@ecnetwork.co.nz> on 2003/03/06 03:13:58 UTC

Process.waitFor bug which might affect CGIServlet

Hi All,

I have encountered what I believe to be a bug in the Sun JVM (1.4.1 at
least). This causes Process.waitFor() and Process.exitValue() to hang
intermittently. As CGIServlet uses process.exitValue(), I would expect
this bug to also cause this servlet to intermittently hang.

Note that this is NOT due to filling STDOUT/STDERR pipes of the
externally executed application
(http://developer.java.sun.com/developer/bugParade/bugs/4109888.html and
friends).


Firstly, has anyone experienced hangs with CGIServlet?

Secondly, would someone here be willing to help me out by trying the
attached code to verify that the problem can be duplicated? I submitted
a bug to Sun in November 2002, and in Feb 2003 received a "cannot
reproduce" mail. However I can reproduce it at will. So can at least one
of my clients :-(


I can reliably duplicate the issue on the following systems:

* Mandrake Linux 9.0 on x86:
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

* RedHat Linux 7.2 on x86:
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)

* Mandrake Linux 9.0 with Blackdown linux 1.4.1:
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build
Blackdown-1.4.1-01)
Java HotSpot(TM) Client VM (build Blackdown-1.4.1-01, mixed mode)


Exactly the same .class file (compiled with the Sun JDK) works correctly
when run on the following:

* Mandrake Linux 9.0 with IBM JVM 1.4.0:
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0)
Classic VM (build 1.4.0, J2RE 1.4.0 IBM build cxia32140-20020917a (JIT
enabled: jitc))

* IBM AIX 5 with IBM JVM 1.4.0:
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0)
Classic VM (build 1.4.0, J2RE 1.4.0 IBM AIX build ca1401-20021126 (JIT
enabled: jitc))

-----------------------
How to run the test app:

(a) save "runme" script, make executable (chmod +x)
(b) compile HangMe.java
(c) java -cp . HangMe runme

The application will print "about to waitFor .. waitFor completed" about
18 times. Then the text "about to waitFor" will be displayed and the
application will hang.

Don't forget the "runme" parameter to tell the app which external
process to invoke - command-line error handling is not implemented :-)

I have a variant of this app which uses a combination of
Process.exitValue(), catch-clause, and sleep() to try to detect external
process termination, but this hangs too, presumably due to the same
underlying issue. This is basically the approach taken by CGIServlet...


Regards,

Simon Kitching
The Electronic Commerce Network Ltd.