Process.waitFor(): a strange behaviour

J

jeffcouc

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.
 
I

Ingo R. Homann

Hi,

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
 
J

jeffcouc

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top