The line exit 0 if $child; indeed exits the parent after fork. That is normal for daemon spawning. Is the problem intermittent, perhaps half the time? It may be that the parent sometimes exits too quickly, causing SIGHUP to be sent to the child before it establishes its independence. Setting $SIG{HUP} to IGNORE or an empty handler before fork should fix that.
Customarily, a daemon's SIGHUP handler causes it to reread configuration files and reconfigure accordingly. That can be set up after the daemon is well started.
You probably should get your daemonizing out of the way before threading. Have you considered daemonizing in a BEGIN block, before use threads; is even seen?
After Compline,
Zaxo
In reply to Re: daemonizing and threads
by Zaxo
in thread daemonizing and threads
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |