[Dovecot] Re: New mail sometimes fails to appear

Tom Alsberg alsbergt at cs.huji.ac.il
Mon Feb 6 17:03:49 EET 2006


On Sun, Feb 05, 2006 at 01:46:16PM +0200, Timo Sirainen wrote:
> Probably mbox_sync_has_changed() would be a good place to put some
> checks.

OK, I put some checks there.  Now here is something interesting:

It appears this function is called several times after activity on the
mbox.

The first time it is called, is through
imap_sync_init->mailbox_sync_init->mbox_storage_sync_init->mbox_sync,
the second is through
imap_sync_deinit->mailbox_sync_deinit->mailbox_transaction_commit->mbox_transaction_commit->mbox_sync,
the third again from imap_sync_init->... and the fourth again from
imap_sync_deinit.

Normally, when new mail arrives, the first three times it returns 1,
and from the fourth on, it returns 0.  EXISTS is sent from
imap_sync_deinit after the second time it returned 1.

However, it happens that on the first call mbox_sync_has_changed
returns 1, but on the second call it returns 0.  Now, the first time
this happens, EXISTS is still sent from imap_sync_deinit to the
client (after the second call to mbox_sync_has_changed).

However after that, when new mail arrives, mbox_sync_has_changed
returns 1 the first time and 0 the next times again, but in
imap_sync_deinit, status.messages and ctx->messages_count are equal,
and thus no EXISTS is sent to the client.

This means, that by looking at the logs including my debug messages
with the values of status.messages and ctx->messages_count and returns
value of mbox_sync_has_changed(...), I can tell whether the next
time new mail arrives to the same user the problem will occur or not.

This is odd...  I'll continue to investigate.  Any idea what this
behaviour may mean?

Besides further clarifications on the operation of sync, could you
describe the path (in terms of functions called) from mbox_sync to the
updating of status.messages?  Perhaps I could put some debugging
messages in there and see what is going on...

  Thanks, regards,
  -- Tom

-- 
  Tom Alsberg - hacker (being the best description fitting this space)
  Web page:	http://www.cs.huji.ac.il/~alsbergt/
DISCLAIMER:  The above message does not even necessarily represent what
my fingers have typed on the keyboard, save anything further.


More information about the dovecot mailing list