You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2005/04/01 23:25:55 UTC
[Bug 4237] New: spamd syslog() SIGCHLD forkbomb
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
Summary: spamd syslog() SIGCHLD forkbomb
Product: Spamassassin
Version: 3.0.2
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P5
Component: spamc/spamd
AssignedTo: dev@spamassassin.apache.org
ReportedBy: kenny+sabugs@romhat.net
Running debian woody with the following packages:
ii spamassassin 3.0.2-0.backports.org.1
ii perl 5.6.1-8.9
ii syslog-ng 1.5.15-1.1
When syslog-ng is reloaded (after log rotation), spamd fails to write to syslog.
Sys::Syslog is configured to fallback to /dev/console (which it does with a
fork). When the child finishes and SIGCHLD is sent to the parent, another log
entry is attempted. This attempt also results in a failure, fork, SIGCHLD,
syslog(), repeat. See most closely related bug 3667, marked as duplicate of bug
3625. Existing spamd children continue to process spamc connections without
logging until they expire. New children are not spawned by the terminally
looped spamd parent. So, depending on mail volume, spamc connection processing
seems to fail at a random time after logrotation.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
------- Additional Comments From kenny+sabugs@romhat.net 2005-04-01 13:35 -------
Created an attachment (id=2747)
--> (http://bugzilla.spamassassin.org/attachment.cgi?id=2747&action=view)
debugging code
This patch provides the code used to produce the strace in attachment 2746.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
spamassassin-contrib@msquadrat.de changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |dev@spamassassin.apache.org
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
------- Additional Comments From kenny+sabugs@romhat.net 2005-04-01 13:40 -------
Created an attachment (id=2749)
--> (http://bugzilla.spamassassin.org/attachment.cgi?id=2749&action=view)
spamd strace with debugging code and my fix attempt
running the same test with attachment 2748 applied to spamd
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
------- Additional Comments From kenny+sabugs@romhat.net 2005-04-01 13:31 -------
Created an attachment (id=2746)
--> (http://bugzilla.spamassassin.org/attachment.cgi?id=2746&action=view)
spamd strace with debugging code added
Being unfamiliar with the code, this helped me track down what was happening.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
------- Additional Comments From kenny+sabugs@romhat.net 2005-04-01 13:44 -------
Created an attachment (id=2751)
--> (http://bugzilla.spamassassin.org/attachment.cgi?id=2751&action=view)
strace of fixed spamd
results with attachment 2750 applied to spamd
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
------- Additional Comments From kenny+sabugs@romhat.net 2005-04-01 13:47 -------
Created an attachment (id=2752)
--> (http://bugzilla.spamassassin.org/attachment.cgi?id=2752&action=view)
the test script used to create strace output attached above
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
------- Additional Comments From kenny+sabugs@romhat.net 2005-04-01 13:38 -------
Created an attachment (id=2748)
--> (http://bugzilla.spamassassin.org/attachment.cgi?id=2748&action=view)
debugging code with my attempt at a bugfix
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
------- Additional Comments From kenny+sabugs@romhat.net 2005-04-01 13:42 -------
Created an attachment (id=2750)
--> (http://bugzilla.spamassassin.org/attachment.cgi?id=2750&action=view)
just the fix
removed debugging code
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
------- Additional Comments From kenny+sabugs@romhat.net 2005-04-01 14:27 -------
attachment 2304 from bug 3625 did not adequately address the problems I was
seeing for several reasons. On my systems, syslog-ng does not send a SIGPIPE
when it reloads. The eval syslog() does not return any errors even on failure
because when Sys::Syslog falls back on /dev/syslog, $! is flushed. Also, the
eval does not get any response from syslog() which is designed to be quiet and
set $! if an error occurred. I like the idea of setting
$main::INHIBIT_LOGGING_IN_SIGCHLD_HANDLER around the syslog() call, but the
strace (attachment 2746) shows that $main::INHIBIT_LOGGING_IN_SIGCHLD_HANDLER is
set back to 0 ("inhibit going 0\n") and the rest of logmsg_syslog() is finished
before the SIGCHLD is seen.
I considered setting $main::INHIBIT_LOGGING_IN_SIGCHLD_HANDLER to 0 only when no
errors are found after syslog(). But it seems that when openlog() passes the
'cons' logopt, no errors are generated. This is even true if /dev/console is
not writable. I notice that the Sys::Syslog bundled with perl 5.8.4 (and
probably earlier versions) ignores the 'cons' logopt and always tries to fall
back on /dev/console. This means the effectiveness of my patch may be limited
to perl 5.6.1. I think further examination of Sys::Syslog error
handling/reporting under later perl versions is warranted. Especially in
combination with syslog-ng.
If you have any questions, please feel free to ask. I will also be idling on
FreeNode in #SpamAssassin for the next few days.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
kenny+sabugs@romhat.net changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #2752|application/x-shellscript |text/plain
mime type| |
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
------- Additional Comments From kenny+sabugs@romhat.net 2005-04-01 13:28 -------
Created an attachment (id=2745)
--> (http://bugzilla.spamassassin.org/attachment.cgi?id=2745&action=view)
unmodified spamd strace
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
------- Additional Comments From jm@jmason.org 2005-04-11 18:49 -------
man, this is idiotic -- it's getting to the stage where I'd rather just put in
our own XS module to perform syslog without Sys::Syslog's bugs! >:(
incredible. Why is Sys::Syslog bothering to fork if it's just going to wait for
the forked process anyway?!
Here's a patch that may do the trick. This one simply avoids logging from the
SIGCHLD handler for any pids that spamd isn't aware it forked.
talk about ugliness. stupid Sys::Syslog and syslog-ng :(
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
jm@jmason.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #2750 is|0 |1
obsolete| |
AssignedTo|dev@spamassassin.apache.org |jm@jmason.org
Status|NEW |ASSIGNED
------- Additional Comments From jm@jmason.org 2005-04-11 18:50 -------
Created an attachment (id=2782)
--> (http://bugzilla.spamassassin.org/attachment.cgi?id=2782&action=view)
possible alternative fix
could you give this a try instead of attachment 2750?
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 4237] spamd syslog() SIGCHLD forkbomb
Posted by bu...@bugzilla.spamassassin.org.
http://bugzilla.spamassassin.org/show_bug.cgi?id=4237
quinlan@pathname.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |major
Priority|P5 |P2
Target Milestone|Undefined |3.1.0
------- Additional Comments From quinlan@pathname.com 2005-04-05 19:53 -------
moving to 3.1.0 milestone
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.