Hello Monks,

Ok, here is my problem: Under mod_perl (running Apache::Registry), I have a script that generates and image and sends it as the output. The image is generated by a third-party module (more specifcially, GraphViz), and can sometimes take a very long time to run (without any really good way to predict when).

Now from the application point of view it would be perfectly fine to just hit Stop on the browser if the image is taking too long and go on about your business (in other words, it's not all that essential for it to complete), of course if a user does that, then the neato process spawned by graphviz will just sit there, eating up cycles (often indefinitely). After a while I'll get enough of the little buggers that all the CPUs are continously busy.

So, what to do? I understand that I can use Apache->request->connection->aborted to check if the user has terminated the session, but that only helps if I am in some sort of loop where I can do the actual check. As it is, I am sitting waiting for GraphViz to do it's thing. I have a vague idea about forking off the process and then having the parent sit in a loop over the connection->aborted check and kill the child (must computer terminology be so morbid?) if it detects a broken connection. But I just don't know enough about IPC to know exactly what to do here.

Any suggestions? Thanks in advance.


In reply to mod_perl, long running process and broken connections by glwtta

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.