Fellow monks,

I have a UNIX program that, depending on the passed in options, could take a couple of minutes up to a couple of days to execute. This program talks to hardware through blocking calls that normally come back in at most a few minutes. However, when 'hardware problems' occur, the program would simply hang (because of blocking calls, as expected). Since these 'hardware problems' could occur at any time, I would like the program to send me an indication (an email probably) wheneven such a hang condition is detected.

I know how to send an email out once the hung state is detected. The question I have is how do I find out that this program is hung on a blocked call? In other words, I need a perl script that would look at the Program Counter (PC) of my program and see if the PC has not changed for some predefined time interval. Can that even be done? Any suggestions?


In reply to Detect a hung process by gri6507

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.