Re: [Clamav-users] clamav on woody: clamav-milter hangs when stopped

2004-11-14 Thread Stephen Gran
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)'
UIDPID  PPID   LWP  C NLWP STIME TTY  TIME CMD
clamav9222 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
clamav9223  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
clamav9224  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)'
UIDPID  PPID   LWP  C NLWP STIME TTY  TIME CMD
clamav1010 1  1010  02 Nov11 ?00:00:00 
/usr/sbin/clamav-milter -dq --pidfile /var/run/clamav/clamav-milter.pid 
local:/var/run/clamav/clamav-milter.ctl
clamav1010 1  1011  02 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]|
 --


pgpTxWdb1aO2o.pgp
Description: PGP signature
___
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-users


Re: [Clamav-users] clamav on woody: clamav-milter hangs when stopped

2004-11-13 Thread Joe Maimon

Stephen Gran wrote:
On Fri, Nov 12, 2004 at 10:29:20AM -0600, Jeremy Kitchen said:
 

On Thursday 11 November 2004 05:56 pm, Stephen Gran wrote:
[snip]
   

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.
 

http://cr.yp.to/daemontools.html
http://smarden.org/runit
makes it very easy to send signals to applications.
   

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?
___
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-users


Re: [Clamav-users] clamav on woody: clamav-milter hangs when stopped

2004-11-12 Thread Jeremy Kitchen
On Thursday 11 November 2004 05:56 pm, Stephen Gran wrote:
[snip]
 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.

http://cr.yp.to/daemontools.html
http://smarden.org/runit

makes it very easy to send signals to applications.

-Jeremy

-- 
Jeremy Kitchen ++ Systems Administrator ++ Inter7 Internet Technologies, Inc.
  [EMAIL PROTECTED] ++ www.inter7.com ++ 866.528.3530 ++ 815.776.9465 int'l
  kitchen @ #qmail #gentoo on EFnet IRC ++ scriptkitchen.com/qmail
 GnuPG Key ID: 481BF7E2 ++ jabber:[EMAIL PROTECTED]


pgpJRGAW4kO7C.pgp
Description: PGP signature
___
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-users


Re: [Clamav-users] clamav on woody: clamav-milter hangs when stopped

2004-11-12 Thread Stephen Gran
On Fri, Nov 12, 2004 at 10:29:20AM -0600, Jeremy Kitchen said:
 On Thursday 11 November 2004 05:56 pm, Stephen Gran wrote:
 [snip]
  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.
 
 http://cr.yp.to/daemontools.html
 http://smarden.org/runit
 
 makes it very easy to send signals to applications.

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.
-- 
 --
|  Stephen Gran  | Old age is the harbor of all ills.   -- |
|  [EMAIL PROTECTED] | Bion|
|  http://www.lobefin.net/~steve | |
 --


pgp4rtHD4Kd7w.pgp
Description: PGP signature
___
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-users


[Clamav-users] clamav on woody: clamav-milter hangs when stopped

2004-11-11 Thread Robert S
I have just upgraded to clamav-milter_0.80-5 on my Debian Woody system. 
When I run
/etc/init.d/clamav-milter stop it hangs.  When I do a ps ax it says
sleep 0.1.  Looks as if the offending line something like this:

if [ -n $PID ]; then
  start-stop-daemon -q -K -o -p $PIDFILE $DAEMON
  while [ -d /proc/$PID ]; do sleep 0.1; done

I think that /proc/$PID isn't going away and its staying in the loop
indefinitely.

I had a similar problem with the last debian release:  start-stop-daemon
wasn't killing the process.

I've had to go back to the old hack of killing daemon and all instances of
clamav-milter.

Has anybody had similar problems?  Any fixes?




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


Re: [Clamav-users] clamav on woody: clamav-milter hangs when stopped

2004-11-11 Thread Thomas Lamy
Robert S schrieb:
I have just upgraded to clamav-milter_0.80-5 on my Debian Woody system. 
When I run
/etc/init.d/clamav-milter stop it hangs.  When I do a ps ax it says
sleep 0.1.  Looks as if the offending line something like this:

if [ -n $PID ]; then
  start-stop-daemon -q -K -o -p $PIDFILE $DAEMON
  while [ -d /proc/$PID ]; do sleep 0.1; done
I think that /proc/$PID isn't going away and its staying in the loop
indefinitely.
I had a similar problem with the last debian release:  start-stop-daemon
wasn't killing the process.
I've had to go back to the old hack of killing daemon and all instances of
clamav-milter.
Has anybody had similar problems?  Any fixes?
Please have a look at Debian bug #278198 
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=278198) for an 
in-deep discussion of what's going on/wrong there. I'm sure Stephen Gran 
 (the pkg maintainer) will come up with a new revision (and a woody 
backport) RSN.

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


Re: [Clamav-users] clamav on woody: clamav-milter hangs when stopped

2004-11-11 Thread Stephen Gran
On Thu, Nov 11, 2004 at 11:05:43AM +0100, Thomas Lamy said:
 Robert S schrieb:
 
 I have just upgraded to clamav-milter_0.80-5 on my Debian Woody system. 
 When I run
 /etc/init.d/clamav-milter stop it hangs.  When I do a ps ax it says
 sleep 0.1.  Looks as if the offending line something like this:
 
 if [ -n $PID ]; then
   start-stop-daemon -q -K -o -p $PIDFILE $DAEMON
   while [ -d /proc/$PID ]; do sleep 0.1; done
 
 I think that /proc/$PID isn't going away and its staying in the loop
 indefinitely.
 
 I had a similar problem with the last debian release:  start-stop-daemon
 wasn't killing the process.
 
 I've had to go back to the old hack of killing daemon and all instances 
 of
 clamav-milter.
 
 Has anybody had similar problems?  Any fixes?
 
 Please have a look at Debian bug #278198 
 (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=278198) for an 
 in-deep discussion of what's going on/wrong there. I'm sure Stephen Gran 
  (the pkg maintainer) will come up with a new revision (and a woody 
 backport) RSN.

What kernel are you running? (I'm asking Robert, obviously).

The short version is that I have found through trial and error that
the 2.4 series of linux kernels don't implement threads that well -
each thread has a different PID (instead of more properly appearing
as the same PID, but with a different LWP ID), and inter-thread signal
communication is not very quick.  2.6 handles this much better.

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.  Hence the parent stays around for a long time, and the shutdown
takes a long time to happen.  The alternative is just to send a kill
signal and move on, but then you have problems on restart if the old
process hasn't died yet.

The woody backport out there has my first hackish and totally non-portable 
attempt to work around this - a better and portable one is sitting on my
development machine while I think about this some more.  The new one
borrows liberally from squid's shutdown script, and will tell you that
it's still waiting for the process to go away, so it at least won't
appear to 'hang', although it may still take some time.

So, for Robert, can you do a couple of things for me?

Let me know the output of:
uname -a
ps -el | egrep '(PID|clamav-milter)'

And also try running the milter (and clamd - they're tied together
unfortunately, in this) without daemon and let me know how a shutdown
goes?  To do this, stop clamd and the milter, comment out Foreground,
and start them both again.  Then try:
time /etc/init.d/clamav-milter stop.

Reply either on or off list - this is more of packaging issue than a
clamav one, strictly, so I don't mind taking it to private email.

Thanks,
-- 
 --
|  Stephen Gran  | Just because you're paranoid doesn't|
|  [EMAIL PROTECTED] | mean they AREN'T after you. |
|  http://www.lobefin.net/~steve | |
 --


pgpl6CiepROsG.pgp
Description: PGP signature
___
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-users