fetchmail-friends
[Top] [All Lists]

[fetchmail]bug in connecting to smtp

2001-12-11 22:54:53
When the protocol is set to auto and a timeout occurs on IMAP after a
few mails have been downloaded, fetchmail switches to POP3. The
transaction goes as follows:

(I have skipped the IMAP and POP3 transactions and the header
analysis)

Dec 10 10:45:50 alice fetchmail[16523]: 5.9.5 querying 
mailserver.retortsoft.com (protocol auto) at Mon, 10 Dec 2001 10:45:50 +0530 
(IST): poll started 
Dec 10 10:45:50 alice fetchmail[16523]: 5.9.5 querying 
mailserver.retortsoft.com (protocol IMAP) at Mon, 10 Dec 2001 10:45:50 +0530 
(IST): poll started 
Dec 10 10:45:53 alice fetchmail[16523]: Protocol identified as IMAP4 rev 1 
Dec 10 10:45:54 alice fetchmail[16523]: selecting or re-polling default folder 
Dec 10 10:45:56 alice fetchmail[16523]: 122 messages waiting after first poll 
Dec 10 10:45:56 alice fetchmail[16523]: 122 messages for 
default(_at_)bombay(_dot_)retortsoft(_dot_)com at mailserver.retortsoft.com. 
Dec 10 10:46:00 alice fetchmail[16523]: reading message 
default(_at_)bombay(_dot_)retortsoft(_dot_)com@mailserver.retortsoft.com:1 of 
122 (924 header octets) 
Dec 10 10:46:00 alice fetchmail[16523]: SMTP< 220 alice.bombay.retortsoft.com 
ESMTP Sendmail 8.11.3/8.11.3; Mon, 10 Dec 2001 10:46:00 +0530 
Dec 10 10:46:00 alice fetchmail[16523]: SMTP> EHLO localhost 
Dec 10 10:46:00 alice fetchmail[16523]: SMTP< 250-alice.bombay.retortsoft.com 
Hello localhost [127.0.0.1], pleased to meet you 
Dec 10 10:46:00 alice fetchmail[16523]: SMTP< 250-ENHANCEDSTATUSCODES 
Dec 10 10:46:00 alice fetchmail[16523]: SMTP< 250-8BITMIME 
Dec 10 10:46:00 alice fetchmail[16523]: SMTP< 250-SIZE 
Dec 10 10:46:00 alice fetchmail[16523]: SMTP< 250-ONEX 
Dec 10 10:46:00 alice fetchmail[16523]: SMTP< 250-XUSR 
Dec 10 10:46:00 alice fetchmail[16523]: SMTP< 250 HELP 
Dec 10 10:46:01 alice fetchmail[16523]: forwarding to localhost 
Dec 10 10:46:01 alice fetchmail[16523]: SMTP> MAIL 
FROM:<tatainfotechthane(_at_)indiatimes(_dot_)com> SIZE=42030 
Dec 10 10:46:01 alice fetchmail[16523]: SMTP< 250 2.1.0 
<tatainfotechthane(_at_)indiatimes(_dot_)com>... Sender ok 
Dec 10 10:46:01 alice fetchmail[16523]: SMTP> RCPT 
TO:<shailesh(_at_)bombay(_dot_)retortsoft(_dot_)com> 
Dec 10 10:46:01 alice fetchmail[16523]: SMTP< 250 2.1.5 
<shailesh(_at_)bombay(_dot_)retortsoft(_dot_)com>... Recipient ok 
Dec 10 10:46:01 alice fetchmail[16523]: SMTP> DATA 
Dec 10 10:46:01 alice fetchmail[16523]: SMTP< 354 Enter mail, end with "." on a 
line by itself 
Dec 10 10:46:02 alice fetchmail[16523]:  (41106 body octets) 
Dec 10 10:53:29 alice fetchmail[16523]: timeout after 300 seconds. 

[ here, connection to smtp server is closed ]

Dec 10 10:53:29 alice fetchmail[16523]: client/server synchronization error 
while fetching from mailserver.retortsoft.com 
Dec 10 10:53:29 alice fetchmail[16523]: 5.9.5 querying 
mailserver.retortsoft.com (protocol IMAP) at Mon, 10 Dec 2001 10:53:29 +0530 
(IST): poll completed 
Dec 10 10:53:29 alice fetchmail[16523]: 5.9.5 querying 
mailserver.retortsoft.com (protocol POP3) at Mon, 10 Dec 2001 10:53:29 +0530 
(IST): poll started 
Dec 10 10:53:37 alice fetchmail[16523]: selecting or re-polling default folder 
Dec 10 10:53:38 alice fetchmail[16523]: 122 messages for 
default(_at_)bombay(_dot_)retortsoft(_dot_)com at mailserver.retortsoft.com 
(2869744 octets). 
Dec 10 10:53:43 alice fetchmail[16523]: reading message 
default(_at_)bombay(_dot_)retortsoft(_dot_)com@mailserver.retortsoft.com:1 of 
122 (42042 octets) 

[ here, it should have reconnected to smtp server ]

Dec 10 10:53:43 alice fetchmail[16523]: forwarding to localhost 
Dec 10 10:53:43 alice fetchmail[16523]: SMTP> MAIL 
FROM:<tatainfotechthane(_at_)indiatimes(_dot_)com> SIZE=42042 
Dec 10 10:53:43 alice fetchmail[16523]: SMTP> RSET 
Dec 10 10:58:49 alice fetchmail[16523]: timeout after 300 seconds. 
Dec 10 10:58:49 alice fetchmail[16523]: client/server synchronization error 
while fetching from mailserver.retortsoft.com 
Dec 10 10:58:49 alice fetchmail[16523]: 5.9.5 querying 
mailserver.retortsoft.com (protocol POP3) at Mon, 10 Dec 2001 10:58:49 +0530 
(IST): poll completed 
Dec 10 10:58:49 alice fetchmail[16523]: 5.9.5 querying 
mailserver.retortsoft.com (protocol auto) at Mon, 10 Dec 2001 10:58:49 +0530 
(IST): poll completed 
Dec 10 10:58:49 alice fetchmail[16523]: Query status=7 (ERROR) 
Dec 10 10:58:49 alice fetchmail[16523]: SMTP> QUIT 
Dec 10 10:58:49 alice fetchmail[16523]: Deleting fetchids file. 
Dec 10 10:58:49 alice fetchmail[16523]: normal termination, status 7 
Dec 10 10:58:49 alice fetchmail[16523]: Deleting fetchids file. 

Essentially, the timeout causes the smtp socket to be closed. This
socket is not reopened later.

Here is a patch which should fix it (Not tested):

===========================================================================
diff -Naur fetchmail-5.9.5.orig/driver.c fetchmail-5.9.5/driver.c
--- fetchmail-5.9.5.orig/driver.c       Mon Oct  1 08:20:56 2001
+++ fetchmail-5.9.5/driver.c    Wed Dec 12 10:51:42 2001
@@ -788,10 +788,14 @@
 
        /* try to clean up all streams */
        release_sink(ctl);
-       if (ctl->smtp_socket != -1)
+       if (ctl->smtp_socket != -1) {
            cleanupSockClose(ctl->smtp_socket);
-       if (mailserver_socket != -1)
+           ctl->smtp_socket = -1;
+       }
+       if (mailserver_socket != -1) {
            cleanupSockClose(mailserver_socket);
+           mailserver_socket = -1;
+       }
     }
     else
     {
===========================================================================

Sunil Shetye.


<Prev in Thread] Current Thread [Next in Thread>
  • [fetchmail]bug in connecting to smtp, Sunil Shetye <=