<<< Date Index >>>     <<< Thread Index >>>

Re: IMAP command pipelining (batched mailbox polling) now in CVS



On Monday, 19 December 2005 at 01:19, Vincent Lefevre wrote:
> On 2005-12-17 23:15:07 -0800, Brendan Cully wrote:
> > Looking back over this, this is probably not a timeout issue, but
> > simply something going wrong with the pipelining code. The message is
> > that a timeout will expire in 26 minutes, which means you've probably
> > been idling for about 4. A .muttdebug0 snippet starting from the IDLE
> > before the * OK Timeout message would be helpful.
...
> Here is it:
> < + Waiting for DONE
> > DONE
> a0029 IDLE
> < * 223 EXISTS
> Handling EXISTS
> cmd_handle_untagged: New mail in INBOX - 223 messages total.
> < * 1 RECENT
> < * OK Timeout in 30 minutes
> < a0028 OK IDLE completed
> imap_cmd_finish: Fetching new mail
> message.c:99: mutt_mktemp returns "/var/tmp/mutt-dixsept-325-12367-27".
> > a0030 FETCH 223:223 (UID FLAGS INTERNALDATE RFC822.SIZE 
> > BODY.PEEK[HEADER.FIELDS (DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES 
> > CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST 
> > X-LABEL)])
> < + Waiting for DONE
> < a0029 BAD Bogus IDLE continuation

Ah, this was helpful. I think I found a race that could lead to
this. Can you try the attached patch?
diff -r e13d3daf0cb4 imap/imap.c
--- a/imap/imap.c       Mon Dec 19 00:13:43 2005
+++ b/imap/imap.c       Sun Dec 18 16:43:48 2005
@@ -1261,15 +1261,16 @@
           || force || time(NULL) >= idata->lastread + ImapKeepalive))
   {
     imap_cmd_start (idata, "IDLE");
+    idata->state = IMAP_IDLE;
     do
       result = imap_cmd_step (idata);
     while (result == IMAP_CMD_CONTINUE);
     if (result != IMAP_CMD_RESPOND)
     {
       dprint (1, (debugfile, "Error starting IDLE\n"));
+      idata->state = IMAP_SELECTED;
       return -1;
     }
-    idata->state = IMAP_IDLE;
   }
   if (idata->state == IMAP_IDLE)
   {

Attachment: pgpabhpDzmgdT.pgp
Description: PGP signature