[exim] O_NONBLOCK / ``421 lost input connection'' in exim 4.…

Etusivu
Poista viesti
Vastaa
Lähettäjä: Chris Lightfoot
Päiväys:  
Vastaanottaja: exim-users
Aihe: [exim] O_NONBLOCK / ``421 lost input connection'' in exim 4.60
On upgrading to exim 4.60 from FreeBSD ports, I found that
exim would terminate all connections immediately after
sending the banner, with the ``421 lost input connection''
error and reporting Resource temporarily unavailable in
the system log. (This occured for both bona fide SMTP
connections and also -bh test sessions.)

Further inspection with ktrace indicates that something
was setting O_NONBLOCK on the input stream (smtp_in in
smtp_in.c); the first read from the stream will then
typically fail with -EAGAIN, which is treated as an error.
The following patch fixes it:

--- src/smtp_in.c.orig  Tue Mar 21 11:24:05 2006
+++ src/smtp_in.c       Tue Mar 21 11:23:10 2006
@@ -2096,6 +2096,8 @@


DEBUG(D_receive) debug_printf("smtp_setup_msg entered\n");

+fcntl(fileno(smtp_in), F_SETFL, 0); /* cwrl 20060321 */
+
/* Reset for start of new message. We allow one RSET not to be counted as a
nonmail command, for those MTAs that insist on sending it between every
message. Ditto for EHLO/HELO and for STARTTLS, to allow for going in and out of

but it's not clear why this should be necessary -- exim
doesn't ever set O_NONBLOCK on that fd, so far as I can
tell. Previously people have reported a similar problem
being related to libpq (the PostgreSQL client library) but
we aren't using that here.

So, anyway, I have a temporary fix, but if it'd be useful
to investigate this further I'm happy to help.

--
Chris Lightfoot
mySociety