[milters] Archive

Lists Index Date Thread Search

Article: 538
From: Anthony Howe
Date: 2005-05-03 07:00:14 -0400
Subject: Re: milter-sender: why SIGQUIT on shutdown ?

Removal...........: milters-request@milter.info?subject=remove
More information..: http://www.milter.info/#Support
--------------------------------------------------------

Jamie Jones wrote:
> |	NAME=`basename "$PROGRAM"`
> |        announce("Stopping $NAME")
> |
> |	pid=`getpid "$PROGRAM"`
> |	if test X"$pid" != X ; then
> |		# The libmilter documentation specifies that only
> |		# uncatchable signals can kill the milter, so no
> |		# point in trying a clean shutdown. HUP, TERM, and
> |		# INT are slow, in that they wait for connections
> |		# to complete or for the next request by Sendmail.
> |		kill -QUIT $pid
> |
> |		pid=`getpid "$PROGRAM"`
> |		if test X"$pid" != X ; then
> |			kill -KILL $pid
> 
> ..
> 
> I'm not sure why you are doing a SIGQUIT, which will try and dump core,

No. If you looked at the milter code, the SIGQUIT handler has been 
replaced with a clean shutdown "now" behaviour, so there is no core 
dump. INT, TERM, and HUP are intercepted by libmilter and are outside my 
control. They can take too long to shutdown depending on the sendmail 
session en cours and timeout settings.

SIGQUIT was used to ensure that the milter is stopped within moments of 
being asked to stop, not minutes.

> when you are doing a SIGKILL afterwards anyway.

No. The SIGKILL only happens if the milter does not stop immediately.

> The clean shutdown *is* good, because it causes the latest cache.db
> to be written (when using flatfiles, at least), and cleanly removes
> the PID and socket files.

The SIGQUIT is MY clean shutdown. Maybe a "sleep 2" after the kill -QUIT 
might be useful if you find you're hitting the SIGKILL to frequently.

> Additionally, if the clean shutdown does take too long, your "KILL"
> which takes place a second later will sort that.
> 
> In other words, to me, replacing "kill -QUIT" with "kill -TERM"
seems
> a much better solution...

kill -TERM and -INT are NOT guaranteed to happen when I want them to 
happen. I've seend a -TERM take 15 minutes or more if issued from the 
command line. Granted in my script the kill -KILL will sort out those 
cases, but I still needed a kill "now" and from experience TERM, INT, 
and HUP don't give me that.

In the next release of milters, the startup scripts have been revamped 
anyways, as too the milter start/stop sequence.

-- 
Anthony C Howe                                 +33 6 11 89 73 78
http://www.snert.com/       ICQ:
7116561         AIM: Sir Wumpus

in the mist of night / by the silent sea / a siren calls - Anthony

Lists Index Date Thread Search