Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Recovering from system call errors (http://www.velocityreviews.com/forums/t903395-recovering-from-system-call-errors.html)

novahokie@gmail.com 06-08-2007 01:44 PM

Recovering from system call errors
 
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.


comp.llang.perl.moderated 06-12-2007 04:41 AM

Re: Recovering from system call errors
 
On Jun 8, 6:44 am, novaho...@gmail.com wrote:
> 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,
--
Charles DeRykus









All times are GMT. The time now is 12:56 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.