troubleshooting Question

signal trapping in a daemonized server

Avatar of jjharr
jjharr asked on
4 Comments1 Solution316 ViewsLast Modified:
I have a Perl daemon that operates as both a networking client and a server using various modules. It works fine.

Except... I need to introduce use of a periodic SIGALRM handler and that doesn't work fine. The handler runs once and then the program dies silently. Alarm code is below. I've grepped through most of the module sources and as far as I'm aware, none of them are using SIGALRM. If I eliminate the networking and just run a daemon with a while(1) loop, it works fine (but that's not so useful). I don't even know how to debug it. Any help would be very welcome.
local $SIG{'ALRM'} = \&logme;
setitimer(ITIMER_REAL, 10, 10);
sub { $log->info("Alarm handler");}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros