Bug 4049 - RFE: stop spam detection at maximum load average
Summary: RFE: stop spam detection at maximum load average
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: 3.0.1
Hardware: Other other
: P5 enhancement
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-23 00:27 UTC by Martin Kutschker
Modified: 2019-03-02 17:27 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status
patch against 3.0 patch None Daryl C. W. O'Shea [HasCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Kutschker 2004-12-23 00:27:11 UTC
If the the system load gets very high (for whatever reasons) I (as as system
administrator) may want to decide that I rather get spam mails than to loose my
system. So a way to tell spamd a maximum value for the load average would be
nice. Could be a command line switch or an entry in the config files.

Above the maximum load spamd should either report the failure or silently choose
not do any scanning and report a score of 0.0. Perhaps this alternatives can be
some configuration options as well.
Comment 1 Daryl C. W. O'Shea 2005-01-11 21:08:56 UTC
Created attachment 2602 [details]
patch against 3.0

I've been running this for about a day now... works pretty nice.  I should have
wrote it sooner.

Adds --max-load-average option to spamd.  Once the set load average threshold
is exceeded spamd (almost) immediately closes the connection on the spamc
client, causing spamc to try another spamd server (if the spamc -d flag is
used) or return the unscanned message.	The child's connection counter is not
incremented so that killing & respawning the child doesn't add to the system's
load.

If there's interest, I'll edit the patch to work against trunk too.


Daryl
Comment 2 Daryl C. W. O'Shea 2005-01-11 21:27:11 UTC
Oops... -d doesn't fall back to the next host listed, it just returns the
message unscanned.
Comment 3 Bob Menschel 2005-04-09 18:25:22 UTC
Martin, Daryl, would a viable alternative, for some sites, be: 
If system load gets very high, then freeze mail processing. Don't drop emails;
don't ignore them. Allow them to queue up, and when system load drops to
reasonable levels, process those emails. 

The mechanism would have to be sturdy and survive reboot (ie: system load goes
through the roof, and admin "fixes" the problem by rebooting the system -- the
email system should pick up where it left off). 
Comment 4 Daniel Quinlan 2005-04-09 18:54:41 UTC
Subject: Re:  RFE: stop spam detection at maximum load average

How about this as a maintainable way?

 - We add a plugin API where various bits of code can query the system
   load and available memory.

 - The API is farmed out to OS-specific plugins to implement those
   methods.

 - Plugins that consume lots of resources can call that API to determine
   the system load and available memory and act accordingly.

For example, TextCat could call the API and determine whether or not to
run.  The same for network tests (memory more than CPU), Bayes, AWL, and
even foreign language body rules (CPU)!

This API is something we can do without relying on any type of message
queueing.

Comment 5 Martin Kutschker 2005-04-10 01:08:38 UTC
Bob, stopping mail receiving is not an option for a site thaz get 15.000 to
20.000 mails per day (not counting the ones rejected by RBL).

Daniel, your proposal sounds interesting. Better to have some weak defences than
none.
Comment 6 John Madden 2005-04-11 04:15:50 UTC
(In reply to comment #4)
> Subject: Re:  RFE: stop spam detection at maximum load average
> 
>  - Plugins that consume lots of resources can call that API to determine
>    the system load and available memory and act accordingly.
> 
The plugin that checks the system load, and decides not to run should then
report this is some way. Otherwise, there could be a spate of bugs like "X
doesn't work sometimes" etc.
Comment 7 Daryl C. W. O'Shea 2006-12-06 11:07:12 UTC
This can now be done, including what Daniel outlined, with a custom Check
plugin.  Since it's highly dependent on the underlying OS it's not going to
happen in time for 3.2 though.  Kicking to 3.3.
Comment 8 Mark Martinec 2007-09-26 05:31:26 UTC
Btw, a widespread usage of such feature would encourage spammers
to shift their spamming strategy to send their junk in bursts
to target hosts, instead of more randomly spreading across
recipients from various domains. It would be easy enough to do
so, and everone would then suffer. IMO it would be a misfeature.
Comment 9 Justin Mason 2010-01-27 02:20:52 UTC
moving most remaining 3.3.0 bugs to 3.3.1 milestone
Comment 10 Justin Mason 2010-01-27 03:16:35 UTC
reassigning, too
Comment 11 Mark Martinec 2010-01-27 04:02:31 UTC
Retargeting to: Undefined
Comment 12 Giovanni Bechis 2019-02-20 16:56:49 UTC
I think that Mail::SpamAssassin::Plugin::ResourceLimits could be used for this purpose nowadays.
Comment 13 Giovanni Bechis 2019-03-02 17:27:42 UTC
Mail::SpamAssassin::Plugin::ResourceLimits can be used starting from 3.4.2,
older versions are not supported or does not make sense to add compatibility glue.