Recovering from system call errors

N

novahokie

In my perl script I make several system calls to start scripts. These
scripts launch other applications, e.g. one of the applications is a
java application and the java application in turn launches a C++
application. The problem I am having is that if the C++ application
crashes (which it has been known to do) my script still waits for the
system call to return. And I can't modify the java + c++
applications. Is there a way for me to watch these processes and be
able to handle a crash via perl?

Thanks.
 
C

comp.llang.perl.moderated

In my perl script I make several system calls to start scripts. These
scripts launch other applications, e.g. one of the applications is a
java application and the java application in turn launches a C++
application. The problem I am having is that if the C++ application
crashes (which it has been known to do) my script still waits for the
system call to return. And I can't modify the java + c++
applications. Is there a way for me to watch these processes and be
able to handle a crash via perl?

If Java isn't detecting and returning an error
when C++ crashes, there probably aren't any easy
solutions. Unix can provide Proc::processTable
to scan the process table for id's and ppid's.
You could conceivably start a separate thread or
process that'd intermittently check processes to ensure Java and C++
are still running. In that
case you may possibly be better off manually
forking or using IPC::Open2/3 to get the Java process id.

What happens to the parent if C++ crashes.. if
Java just hangs in that case and there's a reasonable expected time
framework for Java-C++
to complete, you could just set an alarm and bail out if C++ goes
south.

hth,
 

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,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top