[Dovecot] IDLE timing issue - dovecot or fetchmail issue?

Kirill Miazine km at krot.org
Tue Jan 12 16:26:09 EET 2010


* Matt Doran [2010-01-12 13:40]:
>Hi guys,
>
>Thanks for the great product.  We've used dovecot for ages as our 
>internal mail server and it works great!

Let me second that.

>I've recently started using fetchmail 6.3.9 (with IDLE enabled) to 
>download mail from our ISP (Pair networks).   The ISP is running 
>Dovecot 1.1.16.  I am unable to get the info about the dovecot config 
>at this time.
>
>The IDLE support in fetchmail allows us to deliver mail near 
>instantaneously without the need to poll (which is what we did 
>previously using POP3).

Oh, this is cool.

>However I've noticed an issue where if 2 
>mails are delivered in quick succession fetchmail will only download 
>the first email, and the second will not download.   If I then send 
>in another test email this triggers the download of 2 emails (the 
>original that wasn't downloaded and the test email).
>
>Now I'm wondering whether the issue lies with Dovecot (e.g. a timing 
>issue), or is it fetchmail that isn't implementing the IDLE/download 
>properly.

This is a timing issue, yes, but the IMAP server does what it's supposed
to do - when it sees the first message arrive, it notifies fetchmail
about it. Fetchmail immediately ends IDLE session by sending DONE and
starts fetching that one message. If DONE wasn't sent, the server would
issue another response notifying you about the second message, but it
doesn't get a chance to do so. Please try this: login to server and
enter these commands (to get encrypted connection without using STARTLS
you can use command "openssl s_client -connect mail.XXXX.com:993"):

. login <username> <password>
. select inbox
. idle

Now try send some messages and observe what happens.

When you're done, send these commands to the server

done
. logout

Here's what Dovecot sent to me when idling, I sent 5 messages very
quickly:

* 1 EXISTS
* 2 EXISTS
* 3 EXISTS
* 5 EXISTS

If I'd terminate the IDLE session after the first line, I won't receive
the other lines. So, I'd have to check for new messages myself or start
IDLE session again and wait for yet another message to arrive. Then
Dovecot would tell me about all new messages and I could go on and fetch
them.

>I've attached the output of a fetchmail session showing this problem 
>in action (I've added some annotations to this file starting with 
>>>>>>).  The sequence of events are:
>
>   * Start fetchmail with IDLE enabled
>   * Send 2 emails in quick succession.
>   * Dovecot notifies of the new message
>   * Fetchmail downloads the message
>   * Fetchmail initiates a new IDLE
>   * Then nothing more is delivered. :(
>   * I then send another email, which triggers the 2 to download.
>
>
>I don't know enough about IMAP to understand whether the problem lies 
>with Dovecot or Fetchmail.   Hopefully an IMAP expert will be able to 
>see from the attached IMAP session.

Not being an expert, I tried to provide an explanaition of my
understanding om IDLE. So, in your case it's fetchmail where logic could
be improved.

-- 
     -- Kirill Miazine <km at krot.org>


More information about the dovecot mailing list