Bug 1849596 - Spamassassin 3.4.4+ crashes when demonised with spamd
Summary: Spamassassin 3.4.4+ crashes when demonised with spamd
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: spamassassin
Version: 31
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Kevin Fenzi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-22 11:06 UTC by Gerard Earley
Modified: 2020-07-01 09:26 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-01 09:26:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Gerard Earley 2020-06-22 11:06:43 UTC
Ive tested this with every version of spamassassin-3.4.4 on FC from 30 to 32


Steps to Reproduce:
groupadd spamd
useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
groupadd spamd
chown spamd:spamd /var/log/spamassassin



Amend /etc/sysconfig/spamassassin to

# Options to spamd
SPAMDOPTIONS="-d -c -m5 -H -u spamd --razor-home-dir='/var/lib/razor/' --razor-log-file='sys-syslog' -s /var/log/maillog"


systemctl enable spamassassin
systemctl start spamassassin


/var/log/maillog fills with similar mesages 


Mon Jun 22 10:51:48 2020 [2164] info: util: setuid: ruid=0 euid=0 rgid=0 egid=0
Mon Jun 22 10:51:48 2020 [2163] info: spamd: server started on IO::Socket::IP [::1]:783, IO::Socket::IP [127.0.0.1]:783 (running version 3.4.4)
Mon Jun 22 10:51:48 2020 [2163] info: spamd: server pid: 2163
Mon Jun 22 10:51:48 2020 [2163] info: spamd: server successfully spawned child process, pid 2165
Mon Jun 22 10:51:48 2020 [2163] info: spamd: server killed by SIGTERM, shutting down
Mon Jun 22 10:51:49 2020 [2167] info: logger: removing stderr method
Mon Jun 22 10:51:50 2020 [2172] info: util: setuid: ruid=0 euid=0 rgid=0 egid=0
Mon Jun 22 10:51:50 2020 [2171] info: spamd: server started on IO::Socket::IP [::1]:783, IO::Socket::IP [127.0.0.1]:783 (running version 3.4.4)
Mon Jun 22 10:51:50 2020 [2171] info: spamd: server pid: 2171
Mon Jun 22 10:51:50 2020 [2171] info: spamd: server successfully spawned child process, pid 2173
Mon Jun 22 10:51:50 2020 [2173] info: spamd: server killed by SIGTERM, shutting down
Mon Jun 22 10:51:50 2020 [2171] info: spamd: server killed by SIGTERM, shutting down
Mon Jun 22 10:51:51 2020 [2175] info: logger: removing stderr method
Mon Jun 22 10:51:51 2020 [2179] info: spamd: server killed by SIGTERM, shutting down


and running spamd in debug mode doesn't provide anything clearer


Mon Jun 22 10:52:46 2020 [2269] info: spamd: server started on IO::Socket::IP [::1]:783, IO::Socket::IP [127.0.0.1]:783 (running version 3.4.4)
Mon Jun 22 10:52:46 2020 [2269] dbg: plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x55fd2a19ae60) implements 'prefork_init', priority 0
Mon Jun 22 10:52:46 2020 [2269] info: spamd: server pid: 2269
Mon Jun 22 10:52:46 2020 [2269] info: spamd: server successfully spawned child process, pid 2271
Mon Jun 22 10:52:46 2020 [2269] dbg: prefork: child 2271: entering state 0
Mon Jun 22 10:52:46 2020 [2269] dbg: prefork: new lowest idle kid: none
Mon Jun 22 10:52:46 2020 [2271] dbg: plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x55fd2a19ae60) implements 'spamd_child_init', priority 0
Mon Jun 22 10:52:46 2020 [2269] info: spamd: server killed by SIGTERM, shutting down
Mon Jun 22 10:52:46 2020 [2272] dbg: logger: successfully added file method

Comment 1 Ondřej Lysoněk 2020-06-24 11:35:45 UTC
Thanks for the report. It looks like it's a relatively old problem - I was able to reproduce it with spamassassin-3.4.1-25.fc29 too.

Comment 2 Gerard Earley 2020-06-26 12:15:21 UTC
(In reply to Ondřej Lysoněk from comment #1)
> Thanks for the report. It looks like it's a relatively old problem - I was
> able to reproduce it with spamassassin-3.4.1-25.fc29 too.


NP, it's my first report after many happy years use, I'm glad I wasn't beeing a noob 😁

The last version I found that worked without this issue was spamassassin-3.4.2-2.fc29, which has left me unable to upgrade past fc29.

If a patch or workaround exists allowing me to upgrade past fc29 I'd appreciate someone more experience than me letting me know.

Thanks.

Comment 3 Ondřej Lysoněk 2020-06-29 15:07:21 UTC
(In reply to Gerard Earley from comment #2)
> NP, it's my first report after many happy years use, I'm glad I wasn't
> beeing a noob 😁

You did just fine :). But if I may suggest something, always fill out the "Version of the affected component" field, even if it seems unnecessary.

> If a patch or workaround exists allowing me to upgrade past fc29 I'd
> appreciate someone more experience than me letting me know.

Do you really need spamd to daemonize? If not, you could simply drop the '-d' option from sysconfig.

If you do need it, then you also need to tell systemd that spamassassin is a forking service. To do that, you would put something like the following to the spamassassin service file (note that this needs to go to /etc, otherwise it'll get overwritten on update):
Type=forking
PIDFile=/var/run/spamassassin.pid

and pass a '--pidfile /var/run/spamassassin.pid' option to spamd, e.g. through the sysconfig file.

Does that solve the problem for you?

(I don't know how I didn't realize this before, but this is not really a bug, just misconfiguration.)

Comment 4 Gerard Earley 2020-07-01 09:03:27 UTC
Works perfectly, thanks 👍

And for future reference my /usr/lib/systemd/system/spamassassin.service now is



[Unit]
Description=Spamassassin daemon
After=syslog.target network.target
Wants=sa-update.timer

[Service]
Type=forking
PIDFile=/var/run/spamassassin.pid
EnvironmentFile=-/etc/sysconfig/spamassassin
ExecStart=/usr/bin/spamd $SPAMDOPTIONS
StandardOutput=null
StandardError=null
Restart=always

[Install]
WantedBy=multi-user.target



and my /etc/sysconfig/spamassassin is



# Options to spamd
SPAMDOPTIONS="-q -x -d -c -m1 -H -u spamd --razor-home-dir='/var/lib/razor/' --razor-log-file='sys-syslog' -s /var/log/maillog --pidfile /var/run/spamassassin.pid"



I'm now purring along on  FC32 and everything is five by five. Thanks again.

Comment 5 Ondřej Lysoněk 2020-07-01 09:26:32 UTC
That's great to hear, thanks.

One more thing I realized now: you may want to use /run/spamassassin.pid instead of /var/run/spamassassin.pid, because systemd has recently started complaining in the journal about uses of /var/run.


Note You need to log in before you can comment on or make changes to this bug.