You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Yves Goergen <no...@unclassified.de> on 2019/05/29 22:41:23 UTC

spamd child high CPU usage, connection reset

Hello,

Today SpamAssassin started failing on my server system. I could observe 
the following:

* There are 5 processes named "spamd child" with very high (100%) CPU usage
* The Exim mail server temporarily rejects the recipients because it 
cannot connect to the spamd server

This is the Exim log message that appears very often, like once per message:

 > spam acl condition: error reading from spamd socket: Connection reset 
by peer

Restarting SpamAssassin helps for a while but the problem comes back 
repeatedly.

These are my options from /etc/default/spamassassin:

OPTIONS="--nouser-config --min-children 5 --max-children 20 
--max-conn-per-child 20 --allow-tell"

Here are a few options from my /etc/spamassassin/custom.cf file:

lock_method flock
use_bayes 0
(and then some scores and patterns)

spamd --version
SpamAssassin Server version 3.4.2
   running on Perl 5.22.1
   with SSL support (IO::Socket::SSL 2.024)
   with zlib support (Compress::Zlib 2.068)

The system runs Ubuntu 16.04 x64.

I have never seen this behaviour before. As it is now, the spam filter 
is making my mail service very unreliable for incoming mail. What can I 
do to fix that?

Yves Goergen
http://unclassified.software

Re: spamd child high CPU usage, connection reset

Posted by "Kevin A. McGrail" <km...@apache.org>.
There is a meta that Karsten posted on list and we have it in KAM.cf if you
use and update that.  Masscheck can take days to publish rules
unfortunately.

On Wed, May 29, 2019, 18:59 John Hardin <jh...@impsec.org> wrote:

> On Thu, 30 May 2019, Yves Goergen wrote:
>
> > * There are 5 processes named "spamd child" with very high (100%) CPU
> usage
> ...
> > I have never seen this behaviour before. As it is now, the spam filter
> is
> > making my mail service very unreliable for incoming mail. What can I do
> to
> > fix that?
>
> This will *probably* be fixed in the next rules update, tonight.
>
> There is a rule called __STYLE_GIBBERISH_1 which has runaway scan problems
> with specific data in an HTML message with a <STYLE> tag that is
> apparently appearing in some ham messages the past few days. That rule has
> been fixed and should be included in tonight's rule update, if there are
> no problems in the masscheck and rule publication process.
>
> KAM/BC/et. al.: we should probably keep a close eye on the masscheck
> tonight, and if an update with the fixed rule does not actually go out we
> should be prepared to manually push a rules update with it right away. I
> don't remember the process for doing that.
>
>
> --
>   John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
>   jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
>   key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
> -----------------------------------------------------------------------
>    The more you believe you can create heaven on earth
>    the more likely you are to set up guillotines in the public square
>    to hasten the process.                              -- James Lileks
> -----------------------------------------------------------------------
>   8 days until the 75th anniversary of D-Day
>

Re: spamd child high CPU usage, connection reset

Posted by John Hardin <jh...@impsec.org>.
On Thu, 30 May 2019, Yves Goergen wrote:

> * There are 5 processes named "spamd child" with very high (100%) CPU usage
...
> I have never seen this behaviour before. As it is now, the spam filter is 
> making my mail service very unreliable for incoming mail. What can I do to 
> fix that?

This will *probably* be fixed in the next rules update, tonight.

There is a rule called __STYLE_GIBBERISH_1 which has runaway scan problems 
with specific data in an HTML message with a <STYLE> tag that is 
apparently appearing in some ham messages the past few days. That rule has 
been fixed and should be included in tonight's rule update, if there are 
no problems in the masscheck and rule publication process.

KAM/BC/et. al.: we should probably keep a close eye on the masscheck 
tonight, and if an update with the fixed rule does not actually go out we 
should be prepared to manually push a rules update with it right away. I 
don't remember the process for doing that.


-- 
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
   The more you believe you can create heaven on earth
   the more likely you are to set up guillotines in the public square
   to hasten the process.                              -- James Lileks
-----------------------------------------------------------------------
  8 days until the 75th anniversary of D-Day

Re: spamd child high CPU usage, connection reset

Posted by RW <rw...@googlemail.com>.
On Fri, 31 May 2019 00:50:27 +0100
RW wrote:

> On Thu, 30 May 2019 23:29:10 +0100
> RW wrote:
> 
> > On Thu, 30 May 2019 23:24:06 +0200
> > Yves Goergen wrote:
> > 
> >   
> > > BTW, why doesn't the --max-children option do anything? There are
> > > always 5 child processes, no matter how busy they are. And when
> > > they're all busy, nothing works anymore.    
> > 
> > I couldn't reproduce this on FreeBSD with perl 5.28.  
> 
> Actually I can, and any email causes it. 
...
> I'm sure this is a regression, rather than a long-standing bug. 

Thinking about it a bit more, I think it is long-standing behaviour. 

IIRC what happens is that when a child announces that it's idle, if
there's a waiting client it will get assigned to it and then the number
of children is adjusted. Assigning a new client connection to an
already idle child doesn't cause the number of children to be
adjusted.

Ordinarily this isn't much of a problem, but in this case it can hold
back the spawning of new processes by 5 minute, or indefinitely if the
timeouts fail.

Re: spamd child high CPU usage, connection reset

Posted by RW <rw...@googlemail.com>.
On Thu, 30 May 2019 23:29:10 +0100
RW wrote:

> On Thu, 30 May 2019 23:24:06 +0200
> Yves Goergen wrote:
> 
> 
> > BTW, why doesn't the --max-children option do anything? There are
> > always 5 child processes, no matter how busy they are. And when
> > they're all busy, nothing works anymore.  
> 
> I couldn't reproduce this on FreeBSD with perl 5.28.

Actually I can, and any email causes it. 

With -max-children=20 --min-children=5 , if I start 20 spamc instances,
the number of children remains at 5. If I kill one of the children many
are spawned instantaneously. 

Children can be spawned from the old code in spamd, if the number drops
below the minimum, or from the scaling code, which is event driven
based on child messages. 

I'm guessing that when the code in spamd replaces the killed child it
creates  a cascade of events for the scaling code to use, but
something is going wrong when the spares drop below min-spare.

I'm sure this is a regression, rather than a long-standing bug. 

Re: spamd child high CPU usage, connection reset

Posted by RW <rw...@googlemail.com>.
On Thu, 30 May 2019 23:24:06 +0200
Yves Goergen wrote:


> BTW, why doesn't the --max-children option do anything? There are
> always 5 child processes, no matter how busy they are. And when
> they're all busy, nothing works anymore.

I couldn't reproduce this on FreeBSD with perl 5.28.

Re: spamd child high CPU usage, connection reset

Posted by RW <rw...@googlemail.com>.
On Thu, 30 May 2019 22:40:22 +0100
RW wrote:

> On Thu, 30 May 2019 23:24:06 +0200
> Yves Goergen wrote:
> 
> 
> > BTW, why doesn't the --max-children option do anything? There are
> > always 5 child processes, no matter how busy they are. And when
> > they're all busy, nothing works anymore.  
> 
> What are your arguments to spamd?

Sorry, I missed that you'd already given them.

Re: spamd child high CPU usage, connection reset

Posted by RW <rw...@googlemail.com>.
On Thu, 30 May 2019 23:24:06 +0200
Yves Goergen wrote:


> BTW, why doesn't the --max-children option do anything? There are
> always 5 child processes, no matter how busy they are. And when
> they're all busy, nothing works anymore.

What are your arguments to spamd?

Re: spamd child high CPU usage, connection reset

Posted by Yves Goergen <no...@unclassified.de>.
Thank you,

That's what I've also found somewhere. Since the rules were not fixed 
this morning I have disabled that rule and it's stable again today.

Over the last night I've helped with a workaround to restart spamd every 
20 minutes via cron. The monitoring did show maximum CPU usage several 
times but at least it didn't affect all 5 spamd workers for all the time 
so e-mail delivery still worked.

This issue feels a bit like the recent Firefox add-on certificate bug, 
only that I hadn't read about this one here in the news and it took me 
half a day to figure out the cause.

BTW, why doesn't the --max-children option do anything? There are always 
5 child processes, no matter how busy they are. And when they're all 
busy, nothing works anymore.

Yves



________________________________________
Von: Kenneth Porter <sh...@sewingwitch.com>
Gesendet: Do, 2019-05-30 14:42 +0200
On 5/29/2019 3:41 PM, Yves Goergen wrote:
> Hello,
> 
> Today SpamAssassin started failing on my server system. I could 
> observe the following:
> 
> * There are 5 processes named "spamd child" with very high (100%) CPU 
> usage

This could be the style gibberish rule hanging. There's another thread
here about that. You need to add a line to your local config to
temporarily disable that rule:

meta __STYLE_GIBBERISH_1 0

On my CentOS 7 system, I put that line in
/etc/mail/spamassassin/style-gibberish-rule-hang-workaround.cf and
restarted the SA service and the mimedefang service (which runs its own
copy of SA internally).

Mailing list thread:

https://mail-archives.apache.org/mod_mbox/spamassassin-users/201905.mbox/browser

Bugzilla bug:

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7707



Re: spamd child high CPU usage, connection reset

Posted by Kenneth Porter <sh...@sewingwitch.com>.
On 5/29/2019 3:41 PM, Yves Goergen wrote:
> Hello,
>
> Today SpamAssassin started failing on my server system. I could 
> observe the following:
>
> * There are 5 processes named "spamd child" with very high (100%) CPU 
> usage

This could be the style gibberish rule hanging. There's another thread 
here about that. You need to add a line to your local config to 
temporarily disable that rule:

meta __STYLE_GIBBERISH_1 0

On my CentOS 7 system, I put that line in 
/etc/mail/spamassassin/style-gibberish-rule-hang-workaround.cf and 
restarted the SA service and the mimedefang service (which runs its own 
copy of SA internally).

Mailing list thread:

https://mail-archives.apache.org/mod_mbox/spamassassin-users/201905.mbox/browser

Bugzilla bug:

https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7707