Summary: | mail-filter/spamassassin - openrc-0.3.0-r1 always sees spamd as crashed | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Lars Wendler (Polynomial-C) (RETIRED) <polynomial-c> |
Component: | Current packages | Assignee: | Gentoo Perl team <perl> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | binki, bugs+gentoo, ehmsen, genzilla, ikelos, jochen+gentoo-bugs, jrmalaq, loki_val, Martin.vGagern, pauldv, perl, roy |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
3.0.0-spamd.init.diff
sleep if PID-file not yet created |
Description
Lars Wendler (Polynomial-C) (RETIRED)
2008-10-23 20:11:57 UTC
Which of the both ebuilds did you update before this problem appeared? Also note, denyhosts gets reported as crashed immediately after startup, even though it's still running. It may just be related to the way openrc determines whether a service is still running or not. My guess is that the parent process forks a child and then immediately dies, which openrc classes as an immediate death (even though the exit code is 0) and marks it as crashed. IIRC that must be openrc from version 0.2.5 to 0.3.0-r1 which was the last update of both packages. But I cannot say for sure that openrc-0.2.5 did not see spamd as crashed... spamd is a bitch 1) It's a perl daemon 2) Possibly because of 1, but anyway, it changes /proc/$pid/cmdline to non standard foo 3) The init script should not use name 4) the init script should use a pidfile start-stop-daemon --start --quiet \ --nicelevel ${SPAMD_NICELEVEL:-0} \ --pidfile ${PIDFILE} \ --exec /usr/sbin/spamd -- -d -r ${PIDFILE} "" \ ${SPAMD_OPTS} There we go. Now s-s-d has a pidfile to work with, spamd works fine. There is a small window between s-s-d returning AND spamd writing the pidfile (which is bad - fix spamd) but that's the best we can do. Created attachment 176154 [details, diff]
3.0.0-spamd.init.diff
Here's a patch that incorporates Roy's suggestions.
The bug is with spamassassin's init script. Assigning to perl herd since they maintain that. Created attachment 184236 [details, diff]
sleep if PID-file not yet created
As Roy mentioned there is a small window of opportunity for a race condition with this patch, which breaks repeated restarts. This patch sleeps for 1 second till
(In reply to comment #7) > Created an attachment (id=184236) [edit] > sleep if PID-file not yet created > On my machine, I just disable'd spamd's daemonization. Removing the -d argument for spamd and adding --background to openrc's arguments allows my spamd service to start. I suppose that not waiting for spamd to start up, create its sockets, and create its pidfile is asking for trouble with services that use spamd (like spamass-milter). But I think it's better than the potentially infinite loop suggested by this patch (if spamd writes its pidfile and then dies and removes the pidfile while the script sleeps, or if spamd errors before creating the pidfile). I use mail-filter/spamassassin-3.2.5 and sys-apps/openrc-0.4.3-r1. I first had the error message ``start-stop-daemon: /usr/sbin/spamd died'' when trying to start spamd after upgrading from mail-filter/spamassassin-3.2.1-r1. I have experienced the same problem, where the daemon starts but openrc says it has died, with net-im/ejabberd-2.0.2-r1 (and haven't gotten the courage to pursue that issue yet :-) ). The solution mentionened in comment #8 works fine for me. Will this "officially" be fixed some day? (In reply to comment #7) > Created an attachment (id=184236) [details] > sleep if PID-file not yet created | + if ! [ -f "${PIDFILE}" ]; then | + sleep 1 | + fi | eend $? "Failed to start spamd" After this change, testing for $? isn't useful anymore. (In reply to comment #10) > (In reply to comment #7) > > Created an attachment (id=184236) [details] [details] > > sleep if PID-file not yet created > > | + if ! [ -f "${PIDFILE}" ]; then > | + sleep 1 > | + fi > | eend $? "Failed to start spamd" > > After this change, testing for $? isn't useful anymore. Yeah. spamassassin-3.3.1 had exactly that error but it got fixed in bug #313599. By the way spamassassin-3.3.1 doesn't suffer from this bug anymore so I suggest we can close it as fixed. (In reply to comment #11) > (In reply to comment #10) > > (In reply to comment #7) > > > Created an attachment (id=184236) [details] [details] [details] > > > sleep if PID-file not yet created > > > > | + if ! [ -f "${PIDFILE}" ]; then > > | + sleep 1 > > | + fi > > | eend $? "Failed to start spamd" > > > > After this change, testing for $? isn't useful anymore. > > Yeah. spamassassin-3.3.1 had exactly that error but it got fixed in bug > #313599. By the way spamassassin-3.3.1 doesn't suffer from this bug anymore so > I suggest we can close it as fixed. > new init script seems to have fixed it, closing thanks |