SA Bugzilla – Bug 1697
spamc fails to dump message when running out of memory
Last modified: 2003-03-27 07:23:49 UTC
I'm running spamc as a mail filter. in low memory conditions, spamc fails to dump the message to stdout. as "fail safe" mode is default now, spamc exited with an error code of 0, which made the filter proceed. We've lost a lot of mails due to that error, as the spamc filter "deleted" the complete message body. Therefore raising severity to critical. Now, the cause is a small glitch in message_filter, I'll append a patch. with this patch, I was unable to trigger the condition that it exists without being able to dump the message to stdout. However, its still possible, as various memory allocations can fail in several places, setting the return value to EX_OSERR. I was unable to trigger this case after applying my patch though. Unfortunately, the "fail safe" mode is default, so in this case the message queue filter will continue with whatever was printed to stdout as message body, which can be an empty message in the worst case. It would be good if the man page would describe and recommend the currently undocumented parameter -x to spamc to implement the more sane error handling method of tempfailing the processing, instead of just continuing. Please apply the patch I append in a minute, it makes mail-filtering a lot more robust when spamc runs out of memory while trying to filter the message.
Created attachment 821 [details] patch to ensure that message is dumped to stdout even if running out of memory.
OK, sounds reasonable. I've rewritten your patch, since it collides with another patch on the first chunk (which is not changed anyway, just some formatting).
Created attachment 825 [details] reworked patch, with additional doco
thanks. note the docu is slightly inaccurate. it won't always return error code 75 currently. instead it will return one of the EX_* constants defined. for example in our case where it runs into an ulimit during mail processing, it will exit with EX_OSERR, code 71. maybe it should say "non-zero exit code" and list the possible cases, as quoted from spamd.raw: EX_USAGE => 64, # command line usage error EX_DATAERR => 65, # data format error EX_NOINPUT => 66, # cannot open input EX_NOUSER => 67, # addressee unknown EX_NOHOST => 68, # host name unknown EX_UNAVAILABLE => 69, # service unavailable EX_SOFTWARE => 70, # internal software error EX_OSERR => 71, # system error (e.g., can't fork) EX_OSFILE => 72, # critical OS file missing EX_CANTCREAT => 73, # can't create (user) output file EX_IOERR => 74, # input/output error EX_TEMPFAIL => 75, # temp failure; user is invited to retry EX_PROTOCOL => 76, # remote error in protocol EX_NOPERM => 77, # permission denied EX_CONFIG => 78, # configuration error
OKAY: new patch looks good
ok -- applied -- and I included those constants in the doco too.
thx!