On 2008-04-25 21:24:17 +0200, Jose Luis Martinez wrote: > Peter J. Holzer escribió: > >Jose, can you try this patch? > > > >Index: lib/Qpsmtpd/TcpServer.pm > >=================================================================== > >--- lib/Qpsmtpd/TcpServer.pm (revision 876) > >+++ lib/Qpsmtpd/TcpServer.pm (working copy) > >@@ -109,7 +111,9 @@ > > $self->log(LOGINFO, $line); > > $buf .= "$line\r\n"; > > } > >+ my $prev = alarm(10); > > print $buf or ($self->log(LOGERROR, "Could not print [$buf]: $!"), > > return 0); > >+ alarm($prev); > > return 1; > > } > > > > You caught it!!! It did the trick! > > 3390 451 Incomplete DATA > print() on closed filehandle GEN1 at /usr/bin/qpsmtpd-forkserver line 288. > 3390 Connection Timed Out > > Line 288 in qpsmtp-forkserver is: > > 287 $SIG{ALRM} = sub { > 288 print $client "421 Connection Timed Out\n"; > 289 ::log(LOGINFO, "Connection Timed Out"); > 290 exit; }; > > But why is it the bug only reproducable when using TLS and a plugin that > connecets via DBI? How are these two modules interacting to cause such pain?
As I wrote previously, my guess is that both the mysql library and the tls library catch SIGPIPE but don't call the previously installed signal handler. So only one of them gets called (whichever is registered last) and the other one loses. > And why is the code retrying all those writes? sub respond seems to not > be made to do retry writes... No, but there are at least two layers below that: The PerlIO layer and the TLS layer. Either one could retry an unsuccessful write if the actual cause of the error was lost. > Investigating more: change respond for "log" in SMTP.pm and the bug > disappears!!! (the patch that you propose is not needed anymore). > > unless ( $complete ) { > $self->log(LOGINFO, "Incomplete DATA"); > #$self->respond(451, "Incomplete DATA"); > $self->reset_transaction; # clean up after ourselves > return 1; > } Yes, of course. $self->respond writes the message to the socket (which has already been closed). $self->log writes to the log file (which is still open, and probably not a pipe or socket anyway). So no SIGPIPE happens. hp -- _ | Peter J. Holzer | It took a genius to create [TeX], |_|_) | Sysadmin WSR | and it takes a genius to maintain it. | | | [EMAIL PROTECTED] | That's not engineering, that's art. __/ | http://www.hjp.at/ | -- David Kastrup in comp.text.tex
signature.asc
Description: Digital signature