[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#152270: start-stop-daemon fails to detect already running daemons (patch)



Package: dpkg 
Version: 1.10.2
Severity: grave

I've noticed the following behavior: current version of start-stop-daemon
fails to detect a daemon is already running. It's seems to be merely due to a
change in version 1.10.

I set severity of this report to grave because this can lead to a daemon not
beeing silently not restarted during an upgrade.

It seems to me that the reason for the error is an inverted test in check(pid)
in start-stop-daemon.c : check(pid) check that the process of pid
/var/run/foo.pid is actually running, but if it actually is, it doesn't push
it in the 'found' list, and returns.

(Side effect: with init scripts relying on --make-pif-file, if at some point
--start is called while the daemon is already running, the pid file will be
overwritten with a wrong pid, and then --stop will fail stopping the deamon)

--- start-stop-daemon.orig	2002-07-08 15:11:06.000000000 +0200
+++ start-stop-daemon.c	2002-07-08 15:11:23.000000000 +0200
@@ -686,7 +686,7 @@
 
	return;
 	if (cmdname && !pid_is_cmd(pid, cmdname))
 
	return;
-
if (start && pid_is_running(pid))
+
if (start && !pid_is_running(pid))
 
	return;
 	push(&found, pid);
 }

Example of misbehavior: 

  (Using omniNames init script) 

# /etc/init.d/omniorb-nameserver start
Starting omniorb name server: omniNames.
# cat /var/run/omniNames.pid 
13559
# ps 13559
  PID TTY      STAT   TIME COMMAND
13559 ?        S      0:00 /usr/bin/omniNames
# /etc/init.d/omniorb-nameserver start
Starting omniorb name server: omniNames.
# cat /var/run/omniNames.pid 
13569
# ps 13569
  PID TTY      STAT   TIME COMMAND
# /etc/init.d/omniorb-nameserver stop 
Stopping omniorb name server: omniNames.
# ps auxw |grep omni
root     13559  0.0  0.5  9052 1816 ?     S    15:18   0:00 /usr/bin/omniNames
root     13560  0.0  0.5  9052 1816 ?     S    15:18   0:00 /usr/bin/omniNames
root     13561  0.0  0.5  9052 1816 ?     S    15:18   0:00 /usr/bin/omniNames
root     13562  0.0  0.5  9052 1816 ?     S    15:18   0:00 /usr/bin/omniNames
root     13563  0.0  0.5  9052 1816 ?     S    15:18   0:00 /usr/bin/omniNames
root     13578  0.0  0.2  1708  688 pts/2 S    15:19   0:00 grep omni
# 


-- 
== Thomas Morin   --  GSM: 06 83 20 64 87   --   Tel: 02 98 05 98 54
== thomas.morin@enst-bretagne.fr    --    thomas.morin@tuxfamily.org
== PGP Id:8CEA233D   Key FP:503BF6CFD3AE8719377B832A02FB94E08CEA233D
--



-- 
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: