Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 143460 - mail-filter/spamassassin-3.1.x - spamd doesn't daemonize
Summary: mail-filter/spamassassin-3.1.x - spamd doesn't daemonize
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Perl team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-10 06:43 UTC by Jimmy.Jazz
Modified: 2008-02-27 17:58 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
spamd and children output (spamd.strace.gz,94.26 KB, text/plain)
2006-08-12 08:31 UTC, Jimmy.Jazz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jimmy.Jazz 2006-08-10 06:43:20 UTC
I definitly cannot manage to get spamd working with the --daemonize (-d) option.

i'm using the following settings, 
SPAMD_OPTS=" -r /var/run/spamd/spamd.pid -D -i -A 127.0.0.1/8,192.168.1.0/24 -u spamd -H /var/spool/spamassassin --port=783 --nouser-config -s /var/log/spamd.log"

and mail-filter/spamassassin-3.1.4 ebuild

PS: sorry, i reopened this new bug report. It follows bug 143445 and is quite similar in that way spamd die immediately when called with the -d option. Of course, the problem had nothing to do with a missed environment variable.

Thx for your help

Jj
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-08-10 07:09:53 UTC
Err, -D is *debug*, not daemonize....
Comment 2 Jimmy.Jazz 2006-08-10 08:04:25 UTC
(In reply to comment #1)
> Err, -D is *debug*, not daemonize....
> 

Hello,

okay, that's not my day... you seems really in a bad mood. Anyway, here is the -d option in gentoo  /etc/init.d/spamd file ;)

start() {
        ebegin "Starting spamd"
        start-stop-daemon --start --quiet \
                --exec /usr/sbin/spamd -- -d -r ${PIDFILE} \
                                           ^
                        ${SPAMD_OPTS}
        eend $? "Failed to start spamd"
}

Jj
Comment 3 Yuval Yaari (RETIRED) gentoo-dev 2006-08-10 09:42:43 UTC
Maybe -d and -D don't go hand-in-hand?
Just a wild guess...
Comment 4 Jimmy.Jazz 2006-08-10 10:25:43 UTC
(In reply to comment #3)
> Maybe -d and -D don't go hand-in-hand?
> Just a wild guess...
> 

Hi,

That's for sure a wild guess :) I have checked it before. In fact, i don't use -D in normal use. So just ignore it. 

In debug mode spamd returns the following messages and stops:

Thu Aug 10 19:16:37 2006 [24084] dbg: logger: successfully added file method
Thu Aug 10 19:16:37 2006 [24084] dbg: spamd: creating INET socket:
Thu Aug 10 19:16:37 2006 [24084] dbg: spamd: Listen: 128
Thu Aug 10 19:16:37 2006 [24084] dbg: spamd: LocalAddr: 0.0.0.0
Thu Aug 10 19:16:37 2006 [24084] dbg: spamd: LocalPort: 783
Thu Aug 10 19:16:37 2006 [24084] dbg: spamd: Proto: 6
Thu Aug 10 19:16:37 2006 [24084] dbg: spamd: ReuseAddr: 1
Thu Aug 10 19:16:37 2006 [24084] dbg: spamd: Type: 1
Thu Aug 10 19:16:37 2006 [24084] dbg: logger: adding facilities: all
Thu Aug 10 19:16:37 2006 [24084] dbg: logger: logging level is DBG
Thu Aug 10 19:16:37 2006 [24084] dbg: generic: SpamAssassin version 3.1.4
Thu Aug 10 19:16:37 2006 [24084] dbg: config: score set 0 chosen.
Thu Aug 10 19:16:37 2006 [24084] dbg: message: ---- MIME PARSER START ----
Thu Aug 10 19:16:37 2006 [24084] dbg: message: main message type: text/plain
Thu Aug 10 19:16:37 2006 [24084] dbg: message: parsing normal part
Thu Aug 10 19:16:37 2006 [24084] dbg: message: added part, type: text/plain
Thu Aug 10 19:16:37 2006 [24084] dbg: message: ---- MIME PARSER END ----
Thu Aug 10 19:16:37 2006 [24084] dbg: dns: is Net::DNS::Resolver available? yes
Thu Aug 10 19:16:37 2006 [24084] dbg: dns: Net::DNS version: 0.53
Thu Aug 10 19:16:37 2006 [24084] info: logger: removing stderr method


Jj
Comment 5 Michael Cummings (RETIRED) gentoo-dev 2006-08-12 06:05:33 UTC
(In reply to comment #0)
> i'm using the following settings, 
> SPAMD_OPTS=" -r /var/run/spamd/spamd.pid -D -i -A 127.0.0.1/8,192.168.1.0/24 -u
> spamd -H /var/spool/spamassassin --port=783 --nouser-config -s
> /var/log/spamd.log"
> 

What's the debug output look like (to cut the argument short, -D==debug, line 179 of /usr/bin/spamassassin and in man spamd)? 

-i is missing an ip address to bind to.

I'm curious why you overriding some of these options by the way, but I suppose knowing what your actual error output is will help.
Comment 6 Jimmy.Jazz 2006-08-12 08:31:09 UTC
Created attachment 94060 [details]
spamd and children output
Comment 7 Jimmy.Jazz 2006-08-12 08:32:42 UTC
(In reply to comment #5)
> 
> What's the debug output look like (to cut the argument short, -D==debug, line
> 179 of /usr/bin/spamassassin and in man spamd)? 

If -D has no argument then all debugging information is printed.
As remark, that was not a cutting output but really what spamd returns before dying.

To be sure if i haven't overseen something i do the test again with -D=debug has you have suggested me. Also, spamd will this time output the debug messages only. Since spamassassin script cannot be daemonize, i proceed with spamd as usual.

Here is the output,

Sat Aug 12 16:09:42 2006 [23236] info: logger: removing stderr method

and spamd immediately dies after it. As you can see there is nothing to do with that :(

strace is more verbose, see the attachment above (I only altered the hostname and its domain for security purpose). 

I don't know if you can work on it but spamd seems this time to fork children and continue to live. That's an improvement, BUT the owner stays root instead of  the user spamd  as it already should (-u spamd)!!! 
You will get the same behaviour if you run spamd as a service like qmail or djbdns tools. The children stays root !?

ps aux | grep spamd output,

root     24369  1.9  0.1   1684   676 pts/1    S+   16:16   0:02 /usr/bin/strace -f /usr/sbin/spamd -- -d -r /var/run/spamd/spamd.pid -D=debug -i -A 127.0.0.1/8,192.168.1.0/24 -u spamd -H /var/spool/spamassassin --port=783 --nouser-config -s /var/log/spamd.log --max-spare=1 --min-children=1
root     24370  3.1 12.3  67684 63376 pts/1    S+   16:16   0:03 /usr/bin/perl -w /usr/sbin/spamd -- -d -r /var/run/spamd/spamd.pid -D=debug -i -A 127.0.0.1/8,192.168.1.0/24 -u spamd -H /var/spool/spamassassin --port=783 --nouser-config -s /var/log/spamd.log --max-spare=1 --min-children=1
root     24397  0.4 12.4  69152 64180 pts/1    S+   16:16   0:00 spamd child
^^^^
root     24399  0.0 11.7  67684 60372 pts/1    S+   16:16   0:00 spamd child
^^^^

(The owner should be spamd as -u spamd suggests to us !)
Perhaps is it where we have to look for ?

Why doesn't spamd die when it is run with strace or like a service ? I don't know.

> 
> -i is missing an ip address to bind to.

When you miss the ip address, 0.0.0.0 is used by default.

> 
> I'm curious why you overriding some of these options by the way, but I suppose
> knowing what your actual error output is will help.
> 

I need to lower spamd rights. root was not an option. That's why i use the user spamd with no login access et special rights.

-A limits the valid network addresses that are allowed to use spamd port.
--max-spare=1 --min-children=1 are pretty much used to limit the size of spamd in memory (78Mb !).

I hope can help you.

Thx

Jj

Comment 8 Christian Hartmann (RETIRED) gentoo-dev 2006-08-15 22:54:36 UTC
Did you create the user 'spamd'?
Comment 9 Jimmy.Jazz 2006-08-15 23:29:00 UTC
(In reply to comment #8)
> Did you create the user 'spamd'?
> 

yes, of course, and the group as well.

Below, spamd works _without_ the -p flag.

root     13043  0.0  5.0  67404 25792 ?        Ss   07:10   0:03 /usr/bin/perl -w /usr/sbin/spamd -r /var/run/spamd/spamd.pid -i -A 127.0.0.1/8,192.168.1.0/24 -u spamd -H /var/spool/spamassassin --port=783 --nouser-config -s /var/log/spamd.log --max-spare=1 --min-children=1
spamd    13554  2.9 11.5  75456 59432 ?        S    07:11   2:13 spamd child
^^^^^

Comment 10 Jimmy.Jazz 2006-11-19 03:39:28 UTC
Same behavior with spamassassin 3.1.7. Probably a perl v5.8.x bug.

#perl -v

This is perl, v5.8.8 built for i686-linux-thread-multi


Please, don't use -d flag. It doesn't work well. At least modify /etc/init.d/spamd file like the example below.

Thx,

Jj

start() {
        ebegin "Starting spamd"
        start-stop-daemon --start --quiet --background \
                --nicelevel ${SPAMD_NICELEVEL:-0} \
                --exec /usr/sbin/spamd -- -r ${PIDFILE} \
                        ${SPAMD_OPTS}
        eend $? "Failed to start spamd"
}

stop() {
        ebegin "Stopping spamd"
        start-stop-daemon --stop --quiet --retry 20 --pidfile ${PIDFILE}
        eend $? "Failed to stop spamd"
}
Comment 11 Michael Cummings (RETIRED) gentoo-dev 2006-11-22 07:31:20 UTC
Is everyone experiencing this problem running a threaded perl?
Comment 12 Jakub Moc (RETIRED) gentoo-dev 2008-02-27 17:58:14 UTC
Closing a dead bug.