S
sunlight
I have a standalone Perl 5.6 server, running under redhat linux, that
occasionally fork()s in order to farm out some of its tasks to a
separate process. When this occurs, the parent doesn't care about the
child's status or when it completes.. pretty much doesn't ever want to
hear from it again. The problem is, when the child completes its work
and exits, the child's exit call appears to kill the parent as well as
itself.
Have verified this by replacing the child's exit() call with a long
sleep()... in this case, the parent keeps working; in all other cases
the parent dies when the child calls exit(). Things I've tried that
have NOT solved the problem:
- CORE::exit instead of exit() for the child
- Setting SIG{CHLD} in the parent to 'IGNORE', 'DEFAULT', or a basic
reaper sub
- POSIX sigblock in the parent for CHLD, INT, QUIT, etc.
- Having the child close all filehandles, and undef all object
references inherited from the parent, before doing any work
- Debug statements to verify the parent isn't exiting due to errors or
application logic, or accidentally running an exit() intended for the
child; the parent just disappears
The fork from the parent does occur within a perl eval {}; block
(precompiled, no dynamic perl statements); could this be interfering
with the child's exit()?
occasionally fork()s in order to farm out some of its tasks to a
separate process. When this occurs, the parent doesn't care about the
child's status or when it completes.. pretty much doesn't ever want to
hear from it again. The problem is, when the child completes its work
and exits, the child's exit call appears to kill the parent as well as
itself.
Have verified this by replacing the child's exit() call with a long
sleep()... in this case, the parent keeps working; in all other cases
the parent dies when the child calls exit(). Things I've tried that
have NOT solved the problem:
- CORE::exit instead of exit() for the child
- Setting SIG{CHLD} in the parent to 'IGNORE', 'DEFAULT', or a basic
reaper sub
- POSIX sigblock in the parent for CHLD, INT, QUIT, etc.
- Having the child close all filehandles, and undef all object
references inherited from the parent, before doing any work
- Debug statements to verify the parent isn't exiting due to errors or
application logic, or accidentally running an exit() intended for the
child; the parent just disappears
The fork from the parent does occur within a perl eval {}; block
(precompiled, no dynamic perl statements); could this be interfering
with the child's exit()?