...this puzzled me for a while, but the quick answer is, "yes, you are fixing the right problem." It was robartes observation that led me to this conclusion.

Essentially, you are using three process structures in each service event by your server.

Primary Server Client Service instance Process created by system()

I believe that it was the third of those that was returning ECHILD. By resetting handlers on the second level, you made it it possible for the second level process to call wait() appropriately upon the death of its child.

I just peeked to see if I could find evidence that signal handlers for ignored signals are reset during exec() but my notes (for Solaris anyway) say only that signals with handlers are reset to default during exec(). That makes sense because the signal handlers would be part of the parent's process address space, but would not be available to the child. I guess it doesn't matter what that third-level process does with the SIGCHLD because it (presumably) doesn't have any children.

But you do want the second-level process to clean up its child proc structure (ie. to harvest its exit code) when the call to system() is complete.

I don't know if this helps, but I believe that you did the right thing. Bring us back in here if you see any other odd symptoms from your system.

...All the world looks like -well- all the world, when your hammer is Perl.
---v


In reply to Re: Re: Re: Understanding fork + wait by agentv
in thread Understanding fork + wait by jplindstrom

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.