SA Bugzilla – Bug 4655
[patch] init.d spamassassin restart kills wrong process and fails
Last modified: 2006-03-10 18:27:30 UTC
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=161785 Sometimes "service spamassassin stop" fails on distros like Fedora because killproc returns before spamd is fully dead. service spamassassin restart Shutting down spamd: [ OK ] Starting spamd: Could not create INET socket on 127.0.0.1:783: Address already in use (IO::Socket::INET: Address already in use) [FAILED] This happens in instances where PPID wraparound happened. It tried to kill the first process named spamd, which is no longer the parent process, and thus causes this failure. Patch forthcoming target trunk, 3.1.1 and 3.0.5.
Created attachment 3219 [details] spamassassin-3.0.4-4655-initrd-kill-ppid.patch Explicitly creates .pid file when service runs, and uses it in the .pid killproc codepath during service stop. This has the benefit of leaving alone other instances of spamd that might also be running on the system.
+1
Target 3.0.5, although this needs to be applied to other branches too. Two more votes needed.
If this is the place to vote for this for 3.1 too, here's my +1 for that.
explicitly: +1 for all
applied to trunk; revision 345454.
Patch applies cleanly and make test is happy. +1 for 3.0.5 release.
Committed revision 345610. Leaving open to retarget to 3.1.1 Strictly speaking it needs one more vote before committing ot the 3.1.1 branch because Henry voted just on 3.0.5.
+1 for all 3.1 r345719
I was just noticing that this doesn't quite work. SPAMD_PID=/var/run/spamassassin/spamd.pid but nothing ever makes /var/run/spamassassin, so upon starting: Mar 10 17:00:46 eclectic spamd[23924]: spamd: server started on port 783/tcp (running version 3.1.1) Mar 10 17:00:46 eclectic spamd[23924]: spamd: cannot write to PID file: No such file or directory Mar 10 17:00:46 eclectic spamd[23924]: spamd: server pid: 23924 also, the pid file is never cleaned up. in stop: rm -f /var/run/spamd.pid which isn't the right path. anyway, I'll put up a patch in a minute.
Created attachment 3408 [details] just use /var/run/spamd.pid
doesn't that need "-r $SPAMD_PID" on the spamd invocation line?
sorry, I get it; it's cumulative. +1
+1 I keep thinking that there may be a reason why it was in a spamassassin subdirectory and it made that symbolic link, perhaps some RedHat standard, but 1) most if not all of my daemons on my Fedora Core 4 system create pid files in /var/run and don't do that symbolic link to the subdirectory thing, and 2) the way this was just would not work unless something makes the spamassassin subdirectory, which I don't see in the spec file and certainly is not true when make install is done from source. Unfortunately, I will not get to test a new tarball candidate for 3.1.1 until about 8 or 9 hours from now :-(
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=161785#c10 I need to get a similar solution into Red Hat's package. You are right, /var/run/spamd.pid is fine, we just have to be sure other parts are using it properly.
(In reply to comment #15) > +1 > > I keep thinking that there may be a reason why it was in a spamassassin > subdirectory and it made that symbolic link, perhaps some RedHat standard Some packages use a /var/run subdirectory if the program writes the pid file after it drops root privileges. (Similar measures must be taken with /var/log.) Presumably spamd or its script did this in the past?
committed, thanks. Sending spamd/redhat-rc-script.sh Transmitting file data . Committed revision 384991.