>Here's the patch I dreamed up.  If there are no objections, I'll submit
this with a bug report.  
>I've tested it here and it certainly solves my problem.

I'm sorry but this is not solving my problem, I've patched spamd/spamd.raw,
recompiled SA.
When I do a /etc/rc.d/init.d/syslog restart ; spamd is stopping working :(

Here's a part of my /var/log/maillog :

May 15 11:06:40 john postfix/smtp[19858]: BDC4DF032A: to=<[EMAIL PROTECTED]>,
relay=localhost[127.0.0.1], delay=2, status=sent (250 Ok, id=18376-05, from
MTA: Ok: queued as 477B9F032B)
May 15 11:06:40 john postfix/qmgr[10858]: 477B9F032B:
from=<[EMAIL PROTECTED]>, size=2709, nrcpt=1 (queue active)
May 15 11:06:40 john amavis[18376]: TIMING [total 1005 ms] - SMTP DATA: 9
(1%), body hash: 1 (0%), mime parse: 201 (20%), get-file-type: 6 (1%),
unpacker: 1 (0%), get-file-type: 6 (1%), unpacker: 0 (0%), parts: 0 (0%),
AV-scan: 605 (60%), fwd-connect: 18 (2%), fwd-mail-from: 24 (2%),
fwd-rcpt-to: 2 (0%), output-header: 5 (1%), fwd-body: 1 (0%), fwd-rundown:
45 (4%), unlink-2-files: 75 (8%), rundown: 4 (0%)
May 15 11:06:45 john spamd[19871]: clean message (4/5) for (unknown):500 in
5 seconds.
May 15 11:06:45 john spamd[19871]: SIGPIPE received - reopening log socket
May 15 11:06:45 john spamd[19870]: clean message (4/5) for (unknown):500 in
5 seconds.
May 15 11:06:45 john spamd[19870]: SIGPIPE received - reopening log socket
May 15 11:08:09 john sophie[19861]: Sophie child has timed-out (no data
received in 90 seconds) - process killed
May 15 11:08:28 john spamd[19938]: server killed by SIGTERM, shutting down
May 15 11:08:28 john spamd[19938]: SIGPIPE received - reopening log socket
May 15 11:08:28 john spamd[19869]: server killed by SIGTERM, shutting down
May 15 11:08:28 john spamd[19869]: SIGPIPE received - reopening log socket

11:08:28 I shut down spamd after waiting some time; then the process
continue...

May 15 11:08:29 john postfix/pipe[19864]: 477B9F032B: to=<[EMAIL PROTECTED]>,
relay=spamd, delay=109, status=sent (john.domain.com)
May 15 11:08:29 john postfix/pickup[18187]: 25619F032C: uid=500
from=<[EMAIL PROTECTED]>
May 15 11:08:29 john postfix/cleanup[19970]: 25619F032C:
message-id=<[EMAIL PROTECTED]>
May 15 11:08:29 john postfix/qmgr[10858]: 25619F032C:
from=<[EMAIL PROTECTED]>, size=2920, nrcpt=1 (queue active)
May 15 11:08:29 john postfix/cleanup[19970]: B7189F032A:
message-id=<[EMAIL PROTECTED]>
May 15 11:08:29 john postfix/local[19971]: 25619F032C: to=<[EMAIL PROTECTED]>,
relay=local, delay=0, status=sent (forwarded as B7189F032A)
May 15 11:08:30 john postfix/qmgr[10858]: B7189F032A:
from=<[EMAIL PROTECTED]>, size=3050, nrcpt=1 (queue active)
May 15 11:08:30 john postfix/smtp[19972]: connect to
mx04.hotmail.com[64.4.56.135]: Connection refused (port 25)
May 15 11:08:32 john postfix/smtp[19972]: B7189F032A: to=<[EMAIL PROTECTED]>,
relay=mx13.hotmail.com[64.4.50.71], delay=3, status=sent (250 Requested mail
action okay, completed)

Any idea?

Gilles.

-----Original Message-----
From: Michael Stenner [mailto:[EMAIL PROTECTED]] 
Sent: lundi 13 mai 2002 21:27
To: [EMAIL PROTECTED]
Subject: Re: [SAtalk] spamd dying


On Mon, May 13, 2002 at 10:58:55AM -0400, Michael Stenner wrote:
> On Mon, May 13, 2002 at 10:41:45AM -0400, Theo Van Dinter wrote:
> > Well, "broken pipe" is really the process receiving a SIGPIPE.  So a 
> > possible solution would be something like:
> > 
> > my $old = $SIG{'PIPE'};
> > $SIG{'PIPE'} = sub { closelog; openlog ... ; }
> > 
> > do logging;
> > 
> > $SIG{'PIPE'} = $old;
> > 
> > around the logging areas.  That way the signal will be trapped when 
> > appropriate and handled.
> 
> If you guys think that's a reasonable solution, then I'm game.  Unless 
> I hear otherwise, I'll whip something up that does that.

Here's the patch I dreamed up.  If there are no objections, I'll submit this
with a bug report.  I've tested it here and it certainly solves my problem.

                                        -Michael

======================================================================
--- spamd       Mon May 13 14:26:17 2002
+++ spamd-new   Mon May 13 15:19:31 2002
@@ -610,9 +610,37 @@
 
 sub logmsg
 {
+    my $old = $SIG{'PIPE'};
+    $SIG{'PIPE'} = sub { $main::SIGPIPE_RECEIVED++; };
+    
     openlog('spamd','cons,pid',$log_facility);
     syslog('info',"@_");
     if ($opt_D) { warn "logmsg: @_\n"; }
+
+    if ($main::SIGPIPE_RECEIVED) {
+       # SIGPIPE recieved when writing to syslog - this has been
+       # found to occur with syslog-ng after syslog-ng restarts.
+       # Close and reopen the log handle, then try again.
+
+       closelog();
+       openlog('spamd','cons,pid',$log_facility);
+       syslog('info',"@_");
+
+       # now report what happend
+       my $msg = "SIGPIPE received - reopening log socket";
+       if ($opt_D) { warn "logmsg: $msg\n"; }
+       syslog('warning', $msg);
+
+       # if we've received multiple sigpipes, logging is probably
+       # still broken.
+       if ($main::SIGPIPE_RECEIVED > 1) {
+           warn "logging failure: multiple SIGPIPEs received\n";
+       }
+
+       $main::SIGPIPE_RECEIVED = 0;
+    }
+
+    $SIG{'PIPE'} = $old;
 }
 
 sub kill_handler

===========================================================================

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Spamassassin-talk mailing list [EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to