Process.waitFor(): a strange behaviour  
Author Message
jeffcouc





PostPosted: 2005-6-8 18:07:00 Top

java-programmer, Process.waitFor(): a strange behaviour I have a strange behaviour with the Process.waitFor() method under
linux mdk 10.1 and java 1.4.2.

my jar archive reacha.jar launches an external programm via
Runtime.getRuntime().exec,
as done bellow,

proc = Runtime.getRuntime().exec("rv toto.rvqe");
proc.waitFor();

where rv is a shell that lauches a command eprover as shown bellow

gess 28182 0.2 1.6 218592 12532 pts/2 S<l+ 11:03 0:00 java
-jar reacha.jar test.mch
gess 29561 0.0 0.7 7424 6044 pts/2 S<+ 11:05 0:00
/usr/bin//rv toto.rvqe
gess 29727 0.0 0.1 2880 1424 pts/2 S<+ 11:05 0:00 sh -c
eprover ....
gess 29728 99.6 3.3 27376 26300 pts/2 R<+ 11:05 3:03 eprover
...

Sometime, when the eprover command spends a lot of time, and ends after
some minutes,
the method waitFor() does not seem to catch the end of the programm
and does not stop to wait...

gess 28182 0.2 1.6 218592 12532 pts/2 S<l+ 11:03 0:00 java
-jar reacha.jar test.mch
gess 29561 0.0 0.7 7424 6044 pts/2 S<+ 11:05 0:00
/usr/bin//rv toto.rvqe


When I launch by hand the programm rv, it stops alone after the end of
the eprover as shown bellow
gess 522 0.0 0.7 7424 6044 pts/2 S<+ 12:02 0:00 rv
toto.rvqe
gess 688 0.0 0.1 2876 1420 pts/2 S<+ 12:02 0:00 sh -c
eprover ...
gess 689 99.6 2.6 21436 20340 pts/2 R<+ 12:02 1:06 eprover
...

And next no more reference to rv by the ps aux command

Thank a lot for your help.

 
Ingo R. Homann





PostPosted: 2005-6-8 21:36:00 Top

java-programmer >> Process.waitFor(): a strange behaviour Hi,

email***@***.com wrote:
> I have a strange behaviour with the Process.waitFor() method under
> linux mdk 10.1 and java 1.4.2....

AFAIR there are some Bugs concerning this method. However, sometimes (!)
it helps, reading the Output- and Error-Stream of the executed program
(in different Threads!) because if the buffer is full, the program will
not terminate!

Ciao,
Ingo

 
jeffcouc





PostPosted: 2005-6-9 21:02:00 Top

java-programmer >> Process.waitFor(): a strange behaviour

> AFAIR there are some Bugs concerning this method. However, sometimes (!)
> it helps, reading the Output- and Error-Stream of the executed program
> (in different Threads!) because if the buffer is full, the program will
> not terminate!

OK, I'm going to do so.
Thanks