With open(FH,"....|") perl in fact does not open a file, but a pipe to a newly created process. When this process exits, it stays as a zombie as long as parent process does not collects its exit staus. In C this is done by calling wait() or waitpid() function. Perl gives you an abstraction for accessing processed as files, but the final collection of child's exit status must be done anyway and it is done in the close function.

There is no direct or easy way of mod_perl doing this for you (except for some playing with SIGCHLD handler, but there you will be a subject to filehandle leakage as well). So just call close when it is appropriate.

To allway call close on everything that was open is a good practice in any environment not only in mod_perl. But as mod_perl processes are long-running, this bad practice pops up as a problem.


In reply to Re: mod_perl and lazy zombies by gildir
in thread mod_perl and lazy zombies by Odud

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.