Postgrey does not stop after 'sudo service postgrey stop'

Bug #981789 reported by Bruno Léon on 2012-04-14
82
This bug affects 14 people
Affects Status Importance Assigned to Milestone
postgrey (Debian)
Fix Released
Unknown
postgrey (Ubuntu)
Undecided
Unassigned
Nominated for Trusty by Rolf Leggewie

Bug Description

service postgrey stop does not actually stop the service, it stays there running.

pirlo (admin-pirlo) wrote :

same problem here on multiple 12.04 systems:

root@server:~# cat /var/run/postgrey.pid
1302
root@server:~# service postgrey restart
 * Stopping postfix greylisting daemon postgrey [ OK ]
 * Starting postfix greylisting daemon postgrey [ OK ]
root@server:~# cat /var/run/postgrey.pid
19917
root@server:~# ps -ef|grep postgrey
postgrey 1302 1 0 Jun01 ? 00:00:00 /usr/sbin/postgrey --pidfile=/var/run/postgrey.pid --daemonize --inet=10023
root 19995 19772 0 12:45 pts/0 00:00:00 grep --color=auto postgrey
root@server:~# service postgrey status
 * postgrey is not running
root@server:~# kill 1302
root@server:~# service postgrey start
 * Starting postfix greylisting daemon postgrey Pid_file "/var/run/postgrey.pid" already exists. Overwriting!
                                                                                                  [ OK ]
root@server:~# service postgrey status
 * postgrey is running

root@server:~# cat /var/run/postgrey.pid
21897
root@server:~# start-stop-daemon --stop --oknodo --pidfile /var/run/postgrey.pid --name postgrey
No postgrey found running; none killed.

start-stop-daemon does not find the postgrey process - even if I use "--exec /usr/sbin/postgrey" it won't work!

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in postgrey (Ubuntu):
status: New → Confirmed
pirlo (admin-pirlo) wrote :

the problem seem to be that start-stop-daemon uses /proc/pid/stat to identifiy the process - since ubuntu 12.04 stat changed a little bit!

this ist from ubuntu 11.10:
root@server:~# cat /proc/1816/stat
1816 (postgrey) S 1 1816 1816 0 -1 4202816 1088 0 7 0 0 5 0 0 20 0 1 0 78655 12664832 2025 4294967295 134512640 135724624 3215822704 3215822032 3078628388 0 0 128 86023 3239325390 0 0 17 1 0 0 106 0 0

and this one form 12.04:
root@server:~# cat /proc/21897/stat
21897 (/usr/sbin/postg) S 1 21897 21897 0 -1 4202816 1258 0 5 0 2 8 0 0 20 0 1 0 25279596 16523264 2416 4294967295 134512640 135963288 3220517632 3220517008 3077846052 0 0 128 86023 3239400398 0 0 17 3 0 0 150 0 0

if I use "/usr/sbin/postg" to start-stop the daemon it works:
root@server:~# start-stop-daemon --stop --oknodo --pidfile /var/run/postgrey.pid --name /usr/sbin/postg

after that no postgrey process is left

JorSol (jorsol) wrote :

Confirmed, start-stop-daemon uses /usr/sbin/postg as the name...

I made changes to /etc/init.d/postgrey and change $NAME varaible to /usr/sbin/postg in start/stop/reload (next to --name) and it works.

grufo (ml-grufo) wrote :

does not work for me!

if I change $NAME to /usr/sbin/postg nothing happens...

root@egal:/etc/init.d# /etc/init.d/postgrey stop
 * Stopping postfix greylisting daemon /usr/sbin/postg [ OK ]
root@egal:/etc/init.d# ps -ef|grep postgrey
postgrey 1192 1 0 Jul01 ? 00:00:39 /usr/sbin/postgrey --pidfile=/var/run/postgrey.pid --daemonize --inet=10023 --delay=300
root 21447 26998 0 07:14 pts/1 00:00:00 grep postgrey

postgrey is still alive!

Christian Gebler (geblerc) wrote :

Post #3 works for me.

But i didn't understand why "/usr/sbin/postg" is okay for the daemon and the full path not...

Please do something and fix this Bug! :-)

thx

Ian McConnell (ian-c) wrote :

Alternatively, you can just remove the --name option

root# start-stop-daemon --stop --oknodo --pidfile /var/run/postgrey.pid

Also since

root:~# /etc/init.d/postgrey stop

does not stop the daemon, then

root:~# /etc/init.d/postgrey reload

means that the configuration files in /etc/postgrey are *not* reread. You have to manually kill the postgrey daemon and
then start it. Not obvious, if you're trying to figure out why emails are disappearing.

Christian d'Heureuse (chdh) wrote :

I have the same problem and fixed it by making the following modifications in /etc/init.d/postgrey:

added:
PROCNAME=/usr/sbin/postg

replaced:
$NAME by $PROCNAME for start-stop-daemon and status_of_proc

Marius Gedminas (mgedmin) wrote :

Debian bug for this: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=670681

I can't figure out how to make Launchpad link with it.

Marius Gedminas (mgedmin) wrote :

@chdh: There's no need to change the status_of_proc invocation; the "$NAME" there is just for display purposes.

Marius Gedminas (mgedmin) wrote :

Filed an upstream issue for this: https://github.com/schweikert/postgrey/issues/5

Changed in postgrey (Debian):
status: Unknown → New
psl (slansky) wrote :

A patch based on Christian idea described in comment 8 was attached to #1289424 (duplicate of this bug report).

Changed in postgrey (Debian):
status: New → Confirmed
Changed in postgrey (Debian):
status: Confirmed → Fix Committed
Changed in postgrey (Debian):
status: Fix Committed → Fix Released
Marius Gedminas (mgedmin) wrote :

For the record this affects 14.04 LTS too.

summary: - Postgrey does not stop
+ Postgrey does not stop after 'sudo service postgrey stop'
Marius Gedminas (mgedmin) wrote :

As a workaround I replaced /etc/init.d/postgrey with http://sources.debian.net/src/postgrey/1.35-1/debian/postgrey.init/

Åka Sikrom (akrosikam) wrote :

So it's 2016, and this has yet to be fixed in 14.04. Any ideas on who to contact in order to get slansky's patch merged into the official repo's as a bug fix?

Åka Sikrom (akrosikam) wrote :

(…that is, given that it works for everybody)

Fleish (lasnchpad) wrote :

Does anyone know who maintains this package in Ubuntu? Might be worthwhile reaching out to them directly.

Åka Sikrom (akrosikam) wrote :

+1 @lasnchpad

The LP package page only says Antonio Radici, who is an upstream (Debian) package maintainer. According to a Debian bug report (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=670681), this was fixed in Debian in late 2014.

Rolf Leggewie (r0lf) wrote :

This was fixed in Debian in 1.34-1.3, closing the ticket and opening a trusty task.

Changed in postgrey (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.