in reply to forked processes and signal handling

What's down the road? Are the child processes likely to themselves fork? Will the children attempt to share code with the parent? Will you be setting CHLD and HUP handlers?

So long as the Parallel::ForkManager kids are not themselves forking and you haven't set up any signal handlers, there is no need to do anything special. P::FM takes care of the waitpid for each child. Default signal handlers usually do the right thing, as you are seeing.

Since you can't guarantee that the program will only be run from crond, attention to SIGINT may be needed. Test the program from the command line on a machine you control and see if any zombies or forkbombs turn up. The pre-forking server example blocks the parent's SIGINT handler to avoid races while forking and restoring the child SIGINT handler. That's not necessary if you stick with the default handlers.

After Compline,
Zaxo

  • Comment on Re: forked processes and signal handling