On Sat, Nov 13, 2004 at 09:03:43PM -0500, Joe Maimon said:
> Stephen Gran wrote:
> >>On Thursday 11 November 2004 05:56 pm, Stephen Gran wrote:
> >>
> >>>So, when start-stop-daemon (or daemon) sends a kill signal, it ends up
> >>>signalling the wrong thread, and it takes a long time for the signal to
> >>>work.
> >
> >Unfortunately in my role as packaager, I can't make too many assumptions
> >about what methods people are using to run things on their system.
> >
> >Thanks, though.
> >
> Perhaps a Pidfile option?

Well, of course we're signalling the PID in Pidfile, the problem is that
on 2.4 linux kernels, that's not the right thread.  To show this, do
this:

[EMAIL PROTECTED]:~$ ps -el | egrep '(PID|clamav-milter)'
  F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
040 S   109  9222     1  0  69   0 -  1322 select ?        00:00:10 
clamav-milter
040 S   109  9223  9222  0  68   0 -  1322 poll   ?        00:00:13 
clamav-milter
040 S   109  9224  9223  0  69   0 -  1322 rt_sig ?        00:00:00 
clamav-milter
[EMAIL PROTECTED]:~$  ps -eLf | egrep '(PID|clamav-milter)'
UID        PID  PPID   LWP  C NLWP STIME TTY          TIME CMD
clamav    9222     1  9222  0    - Nov09 ?        00:00:10 
/usr/sbin/clamav-milter -dq --pidfile /var/run/clamav/clamav-milter.pid 
local:/var/run/clamav/clamav-milter.ctl
clamav    9223  9222  9223  0    - Nov09 ?        00:00:13 
/usr/sbin/clamav-milter -dq --pidfile /var/run/clamav/clamav-milter.pid 
local:/var/run/clamav/clamav-milter.ctl
clamav    9224  9223  9224  0    - Nov09 ?        00:00:00 
/usr/sbin/clamav-milter -dq --pidfile /var/run/clamav/clamav-milter.pid 
local:/var/run/clamav/clamav-milter.ctl
[EMAIL PROTECTED]:~$ cat /var/run/clamav/clamav-milter.pid
9222
[EMAIL PROTECTED]:~$ uname -mr
Linux 2.4.26-2-686-smp

By contrast:

[EMAIL PROTECTED]:~$ ps -el | egrep '(PID|clamav-milter)'
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
1 S   103  1010     1  0  76   0 - 12899 -      ?        00:00:00 clamav-milter
[EMAIL PROTECTED]:~$ ps -eLf | egrep '(PID|clamav-milter)'
UID        PID  PPID   LWP  C NLWP STIME TTY          TIME CMD
clamav    1010     1  1010  0    2 Nov11 ?        00:00:00 
/usr/sbin/clamav-milter -dq --pidfile /var/run/clamav/clamav-milter.pid 
local:/var/run/clamav/clamav-milter.ctl
clamav    1010     1  1011  0    2 Nov11 ?        00:00:00 
/usr/sbin/clamav-milter -dq --pidfile /var/run/clamav/clamav-milter.pid 
local:/var/run/clamav/clamav-milter.ctl
[EMAIL PROTECTED]:~$ cat /var/run/clamav/clamav-milter.pid
1010
[EMAIL PROTECTED]:~$ uname -mr
Linux 2.6.7-1-686

As you can see, the PID in pidfile is (correctly) the first thread started
by init.  The problem is, 9224 is the thread waiting for signals.  If all
the threads shared a pid, this would be fine - we would signal all the
threads by signalling the PID, and things would work great.  Alternately,
if inter-thread communication worked OK, signalling 9222 would work,
because it would pass the signal to 9224 in a relatively short time.
Neither of these is true, so it takes forever without some hackery.

On Linux 2.6 kernels, the various threads correctly share a PID, but
have seperate LWP IDs, making this work as it should.

Sigh.
-- 
 --------------------------------------------------------------------------
|  Stephen Gran                  | But you'll notice Perl has a goto.      |
|  [EMAIL PROTECTED]             | -- Larry Wall in                        |
|  http://www.lobefin.net/~steve | <[EMAIL PROTECTED]>        |
 --------------------------------------------------------------------------

Attachment: pgpTxWdb1aO2o.pgp
Description: PGP signature

_______________________________________________
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-users

Reply via email to