Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: lost signals

by Malkavian (Friar)
on Jul 20, 2001 at 17:25 UTC ( #98400=note: print w/replies, xml ) Need Help??

in reply to lost signals

How about having two different subs for handling interrupts, one being the default (handled by the server process), and one which redefines the sub when you fork to the child.
The server process handler (to keep things short) sets a flag variable to indicate it should go into shutdown mode as soon as it can (next check point).
At the check point, it enters a pre-die routine that sig INTs the children, then polls them at intervals (I've had SIGCHLDs disappear 'cos they happened while the server was already servicing a SIGCHLD) to see how they're doing.
If they haven't been killed within a particular amount of time, perhaps try a nastier kill (SIGTERM), unless you really need to keep the return value at shutdown time.
Retry as needed, until final time out, at which point you abort even trying to kill the thing, as it's gone beyond all reasonable point of recovery. That last bit shouldn't happen, but it's better to shut down as much as you can cleanly, than have the whole thing hang.
I hope some of this helps...



Replies are listed 'Best First'.
Re: lost signals
by Xanatax (Scribe) on Jul 20, 2001 at 18:16 UTC
    hrm, yeah, i quite like the idea of cleaning up the children, making sure they quit and all. and i think the while process will be easier to deal with if i have a list of active children, and use, instead of just directing signals at the whole process group... seems cleaner anyhow.

    i did manage to get the INT to work, as a force quit, but my QUIT sig doesn't yet... i think at least part of it can be cleared up by actually paying attention to the child procs...


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://98400]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2020-03-30 17:39 GMT
Find Nodes?
    Voting Booth?
    To "Disagree to disagree" means to:

    Results (175 votes). Check out past polls.