[Dev] Re: [Dev] Re: simple daemon dies

Michael Mueller dev@trilug.org
Thu, 30 May 2002 09:09:48 -0400


On Thursday 30 May 2002 00:25, Peter Long reputedly wrote:
<snip> The only signal I am handling is SIGQUIT. I
> use it to set a flag that causes all the worker threads in my daemon to
> exit. It works perfectly.

What happens when the the daemon is abruptly killed?   Happy ending with a 
clean restart?
>
> I was wondering if there is a template out there showing a reference
> implementation of signal handlers? If seems dangerous to just let the
> default handler handle all signals. Does that not mean SIGTERM would zap
> your process without giving you a chance to free file handles, close
> sockets of whatever?

My experience with the default handlers are positive.  I have systems that 
have been running for months that have endured repeated ungraceful endings to 
my multi-daemon application.  I have a script to kill all the remaining 
daemons. I prefer to have a manual cleanup so I can analyse the "crime 
scene".   

There's one nagging problem I can use some help with.  When I run in 
foreground and get a segmentation fault, there is a nice message alerting me 
to this event.  When my daemons hit a seg. fault there's no indication in 
/var/log/messages.  Any hints on how to find clues that a daemon did a seg. 
fault would be most appreciated.
-- 
Mike Mueller
www.ss7box.com