Recovering from system call errors

Discussion in 'Perl Misc' started by novahokie@gmail.com, Jun 8, 2007.

  1. Guest

    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.
     
    , Jun 8, 2007
    #1
    1. Advertising

  2. On Jun 8, 6:44 am, 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
     
    comp.llang.perl.moderated, Jun 12, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Morris

    Recovering from a HD crash

    Peter Morris, Aug 7, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    370
    Lenard Gunda
    Aug 7, 2004
  2. Richard F.L.R.Snashall

    Recovering formatted double

    Richard F.L.R.Snashall, Mar 21, 2006, in forum: Java
    Replies:
    16
    Views:
    850
    Richard F.L.R.Snashall
    Mar 23, 2006
  3. Philip Pemberton

    Recovering gracefully from a realloc() failure

    Philip Pemberton, Apr 20, 2006, in forum: C Programming
    Replies:
    10
    Views:
    541
    Skarmander
    Apr 21, 2006
  4. Jeff Neko
    Replies:
    1
    Views:
    323
    Mark P
    Jun 7, 2006
  5. Replies:
    62
    Views:
    1,414
    jacob navia
    Jan 16, 2008
Loading...

Share This Page