Hi,
I've been using the fix for the last few months, thanks, and it's fixed
the issue with the hang after the reconnect. But it hasn't fixed the
issue where DONE is sent on the new connection, which is what my
original patch addressed.
The full debug logs using 3.38 (including my client's), with the
iptables triggered timeout, are:
==========================================================================
[2016-03-02 22:55:18 +0000] Was idling, sending done:
Sending: DONE
Sent 6 bytes
ERROR: timeout waiting 10s for data from server at /usr/local/share/perl5/Mail/IMAPClient.pm line 1880.
Mail::IMAPClient::__read_more(Mail::IMAPClient=HASH(0x36380b8), IO::Socket::INET=GLOB(0x2a95370), 10) called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1846
Mail::IMAPClient::_read_more(Mail::IMAPClient=HASH(0x36380b8), IO::Socket::INET=GLOB(0x2a95370), 10) called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1657
Mail::IMAPClient::_read_line(Mail::IMAPClient=HASH(0x36380b8)) called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1393
Mail::IMAPClient::_get_response(Mail::IMAPClient=HASH(0x36380b8), qr((?:6|DONE)), undef) called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1327
Mail::IMAPClient::_imap_command_do(Mail::IMAPClient=HASH(0x36380b8), HASH(0x36756f0), "DONE") called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1226
Mail::IMAPClient::_imap_command(Mail::IMAPClient=HASH(0x36380b8), HASH(0x36756f0), "DONE") called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1168
Mail::IMAPClient::done(Mail::IMAPClient=HASH(0x36380b8), 6) called at /home/ldarby/bin/imap_idle.pl line 419
main::done_if_idle() called at /home/ldarby/bin/imap_idle.pl line 297
reconnecting to localhost, last error: timeout waiting 10s for data from server
Connecting with IO::Socket::INET PeerAddr localhost PeerPort 143 Proto tcp Timeout 10 Debug 1
Connected to localhost
Read: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.
Sending: 8 LOGIN ldarby [Redact: Count=8 Showcredentials=OFF]
Sent 24 bytes
Read: 8 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE] Logged in
Sending: 9 SELECT INBOX
Sent 16 bytes
Read: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 6153 EXISTS
* 0 RECENT
* OK [UNSEEN 5] First unseen.
* OK [UIDVALIDITY 1146522623] UIDs valid
* OK [UIDNEXT 95836] Predicted next UID
9 OK [READ-WRITE] Select completed (0.000 secs).
reconnect success(1) on try #1/2
Sending: DONE
Sent 6 bytes
Read: DONE BAD Error in IMAP command : Unknown command.
ERROR: DONE BAD Error in IMAP command : Unknown command. at /usr/local/share/perl5/Mail/IMAPClient.pm line 1365.
Mail::IMAPClient::__ANON__("DONE BAD Error in IMAP command : Unknown command.\x{d}\x{a}") called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1401
Mail::IMAPClient::_get_response(Mail::IMAPClient=HASH(0x36380b8), qr((?:6|DONE)), undef) called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1327
Mail::IMAPClient::_imap_command_do(Mail::IMAPClient=HASH(0x36380b8), HASH(0x36756f0), "DONE") called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1226
Mail::IMAPClient::_imap_command(Mail::IMAPClient=HASH(0x36380b8), HASH(0x36756f0), "DONE") called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1168
Mail::IMAPClient::done(Mail::IMAPClient=HASH(0x36380b8), 6) called at /home/ldarby/bin/imap_idle.pl line 419
main::done_if_idle() called at /home/ldarby/bin/imap_idle.pl line 297
ERROR: timeout waiting 10s for data from server; DONE BAD Error in IMAP command : Unknown command. at /usr/local/share/perl5/Mail/IMAPClient.pm line 1275.
Mail::IMAPClient::_imap_command(Mail::IMAPClient=HASH(0x36380b8), HASH(0x36756f0), "DONE") called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1168
Mail::IMAPClient::done(Mail::IMAPClient=HASH(0x36380b8), 6) called at /home/ldarby/bin/imap_idle.pl line 419
main::done_if_idle() called at /home/ldarby/bin/imap_idle.pl line 297
[2016-03-02 22:55:31 +0000] ERROR: DONE command returned error: timeout waiting 10s for data from server; DONE BAD Error in IMAP command : Unknown command.
[2016-03-02 22:55:31 +0000] Reconnecting in 5 seconds
Started at Wed Mar 2 22:55:36 2016
Using Mail::IMAPClient version 3.38 on perl 5.022000
...
==========================================================================
With my patch, the logs are:
==========================================================================
[2016-03-02 23:06:42 +0000] Was idling, sending done:
Sending: DONE
Sent 6 bytes
ERROR: timeout waiting 10s for data from server at /usr/local/share/perl5/Mail/IMAPClient.pm line 1889.
Mail::IMAPClient::__read_more(Mail::IMAPClient=HASH(0x1f7d160), IO::Socket::INET=GLOB(0x13da568), 10) called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1855
Mail::IMAPClient::_read_more(Mail::IMAPClient=HASH(0x1f7d160), IO::Socket::INET=GLOB(0x13da568), 10) called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1666
Mail::IMAPClient::_read_line(Mail::IMAPClient=HASH(0x1f7d160)) called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1402
Mail::IMAPClient::_get_response(Mail::IMAPClient=HASH(0x1f7d160), qr((?:4|DONE)), undef) called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1336
Mail::IMAPClient::_imap_command_do(Mail::IMAPClient=HASH(0x1f7d160), HASH(0x1fbb6c0), "DONE") called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1227
Mail::IMAPClient::_imap_command(Mail::IMAPClient=HASH(0x1f7d160), HASH(0x1fbb6c0), "DONE") called at /usr/local/share/perl5/Mail/IMAPClient.pm line 1168
Mail::IMAPClient::done(Mail::IMAPClient=HASH(0x1f7d160), 4) called at /home/ldarby/bin/imap_idle.pl line 419
main::done_if_idle() called at /home/ldarby/bin/imap_idle.pl line 297
reconnecting to localhost, last error: timeout waiting 10s for data from server
Connecting with IO::Socket::INET PeerAddr localhost PeerPort 143 Proto tcp Timeout 10 Debug 1
Connected to localhost
Read: * OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE AUTH=PLAIN] Dovecot ready.
Sending: 6 LOGIN ldarby [Redact: Count=6 Showcredentials=OFF]
Sent 24 bytes
Read: 6 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS SPECIAL-USE BINARY MOVE] Logged in
Sending: 7 SELECT INBOX
Sent 16 bytes
Read: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 6153 EXISTS
* 0 RECENT
* OK [UNSEEN 5] First unseen.
* OK [UIDVALIDITY 1146522623] UIDs valid
* OK [UIDNEXT 95836] Predicted next UID
7 OK [READ-WRITE] Select completed (0.000 secs).
reconnect success(1) on try #1/2
[2016-03-02 23:06:55 +0000] Idling:
Sending: 8 IDLE
Sent 8 bytes
Read: + idling
...
==========================================================================
So could you please consider my patch again?
Thanks,
Laurence