[Dovecot] Re: New mail sometimes fails to appear

Timo Sirainen tss at iki.fi
Mon Feb 6 15:46:00 EET 2006


On Mon, 2006-02-06 at 15:31 +0200, Tom Alsberg wrote:
> Can you explain the role of the
> {imap,mailbox}_sync_init/{imap,mailbox}_sync_deinit functions?  Some
> clear notion of that could help me understand what is going on. 

I'll reply more later this evening, but here's a quick explanation:

lib-storage/ code is generic mailbox handling code while imap/ contains
imap-specific code.

lib-storage/index/mbox/mbox-sync.c sync mbox <-> dovecot's index.
lib-storage/index/index-sync.c syncs "client's view of mailbox" <->
dovecot index.

imap/imap-sync.c then just maps lib-storage/index/index-sync.c to IMAP
events.

IDLE works by waiting for some file's mtime to change. When that
happens, it starts the mbox <-> index syncing. There are also some
checks that it doesn't do this if it has reported changes within last 10
seconds or something (point is that if there's IDLE going on and Dovecot
reports new mails to client, but client doesn't react to it, there's no
point in reporting more new mails at least immediately). That's where I
thought might be some bug..

> > > On another note, shouldn't the EXISTS message be on IDLE sent whenever
> > > there is a change in the mailbox?  After all, a message can be
> > > replaced or changed, in which case the number of messages will not be
> > > updated, but one would want the client informed on the change...
> 
> (This is not related to my problem here - which is evident when new
> mail arrives and thus the message count does increase, but anyway)
> 
> > ctx->messages_count is decreased whenever expunges happen (which is the
> > only way to change/replace a mail), so the above checks works correctly.
> 
> What about when a message is changed/replaced from outside of IMAP
> (i.e. a user has a mailer accessing the mailboxes through the
> filesystem)?  I thought Dovecot was supposed to be safe to use
> concurrent with local mail access...

Mails shouldn't be externally modified. Most mail clients that I know of
modify mails using expunge + append method, so I haven't tried to bother
handling that in any nice way. I'm not sure if there even is any good
way to handle it..



More information about the dovecot mailing list