Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 902845 - >=mail-filter/spamassassin-4.0.0: spamd fails to start with error `child process [1234] exited or timed out without signaling production of a PID file: (no status) at /usr/sbin/spamd line 3133.`
Summary: >=mail-filter/spamassassin-4.0.0: spamd fails to start with error `child proc...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Philippe Chaintreuil
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-23 21:05 UTC by Robert Gill
Modified: 2023-04-02 17:09 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Gill 2023-03-23 21:05:09 UTC
It seems like spamd-4.0.0 fails to create a PID file when starting. This also occurs when running the command manually as follows:

/usr/sbin/spamd --max-children=5 --create-prefs --helper-home-dir --daemonize -u spamd -g spamd -r /run/spamd.pid

Running spamd as root produces the same results.

Reproducible: Always

Steps to Reproduce:
Run /etc/init.d/spamd or the command in the description above.
Actual Results:  
spamd fails to start with the above error.

Expected Results:  
spamd should fork into background and continue running.
Comment 1 Robert Gill 2023-03-23 21:07:07 UTC
I didn't include the error in the full description. It is as follows:

spamd fails to start with error `child process [1234] exited or timed out without signaling production of a PID file: (no status) at /usr/sbin/spamd line 3133.`
Comment 2 acmondor 2023-03-26 17:35:54 UTC
I saw this error as well:

Mar 26 11:03:38 pab002 spamd[3141]: config: no rules were found!  Do you need to run 'sa-update'?
Mar 26 11:03:39 pab002 spamd[3124]: child process [3141] exited or timed out without signaling production of a PID file: exit 255 at /usr/sbin/spamd line 3133.

And, noticing the "no rules were found!" in on the first line I ran:

  /etc/cron.daily/update-spamassassin-rules

Afterwards spamd started ok.
Comment 3 acmondor 2023-03-26 18:01:44 UTC
Just wanted to add that running sa-update was indicated at the end of the build (I overlooked that earlier):

* Messages for package mail-filter/spamassassin-4.0.0-r1:
 * Log file: /var/log/portagex/mail-filter:spamassassin-4.0.0-r1:20230326-163713.log
 * 
 * No rules are installed by default. You will need to run sa-update
 * at least once, and most likely configure SpamAssassin before it
 * will work.
 * 
 * Configuration and update help can be found on the wiki:
 * 
 *   https://wiki.gentoo.org/wiki/SpamAssassin
 * 
 * If this version of SpamAssassin causes permissions issues
 * with your user configurations or bayes databases, then you
 * may need to set SPAMD_RUN_AS_ROOT=true in your OpenRC service
 * configuration file, or remove the --username and --groupname
 * flags from the SPAMD_OPTS variable in your systemd service
 * configuration file.
Comment 4 Philippe Chaintreuil 2023-03-27 19:47:19 UTC
Robert, any chance your "spamd" user doesn't have write access to /run/?
Comment 5 Philippe Chaintreuil 2023-03-27 19:51:13 UTC
I guess I should state, it's working for me (as root).
==========================================================================
$ sudo /etc/init.d/spamd stop
 * Stopping spamd ...                                                     [ ok ]

$ ls -la /run/spa*
ls: cannot access '/run/spa*': No such file or directory

$ sudo /etc/init.d/spamd start
 * Starting spamd ...                                                     [ ok ]
$ ls -la /run/spa*
-rw-r--r-- 1 root root 6 Mar 27 15:47 /run/spamd.pid
==========================================================================

In case it matters/helps, the permissions on my /run are:

  drwxr-xr-x 24 root root 960 Mar 27 15:47 /run/
Comment 6 acmondor 2023-03-29 00:24:21 UTC
I dug into the spamd code to understand what's going on in order to ensure this is not a more serious issue and this is was I come up with.

In /usr/sbin/spamd the routine daemonize() (defined at line 3102) gets called at line 1248 to created the daemon process. The fork is succcessful and the parent loops waiting for the newly created process to report back.

The newly created/forked process returns from daemonize() and continues with its initialization. At line 1263 it calls $spamtest->init_learner() which is defined at line 703 in /usr/lib64/perl5/vendor_perl/5.36/Mail/SpamAssassin.pm. That routine in turn calls $self->init(1) at line 709. The routinge init() is defined at line 1666 in /usr/lib64/perl5/vendor_perl/5.36/Mail/SpamAssassin.pm and is what generates the first log message:

Mar 26 11:03:38 pab002 spamd[3141]: config: no rules were found!  Do you need to run 'sa-update'?

When this message is generated it is done through a die() call, so the that newly created/forked process exits and never gets to the point of attempting to created the pidfile, which would be done on line 1299 in /usr/sbin/spamd.

And, since the no attempt was made to create the pid file, the parent process times out and we get the second line log message:

Mar 26 11:03:39 pab002 spamd[3124]: child process [3141] exited or timed out without signaling production of a PID file: exit 255 at /usr/sbin/spamd line 3133.

This confirms, the problem doesn't have anything to do with permissions and
everything to do with the missing rules.
Comment 7 Philippe Chaintreuil 2023-04-02 17:09:20 UTC
Thanks for digging in that deep, acmondor!

If that's the case, it sounds like it's doing what it should.  There's no PID file because spamd isn't actually running.

That said, I'm going to ask around to see if there's a historical or boot-strapping reason we don't run sa-update automatically post-install.