possible seen flag db corruption

David Mansfield cyrus at dm.cobite.com
Wed Dec 11 13:33:10 EST 2013


Hi All,

I'm tracing a problem that is reproducible on cyrus-imapd 2.3.16 on 
centos 6, that occurs when messages are delivered to a mailbox while a 
client is setting flags and retrieving existing messages.

I've attached the logs (from the application side) of the relevant 
protocol trace. The log includes the fetch of 119 messages (all 
relatively identical) which makes it a bit bloated. I apologize.  Also, 
some information has been changed to "protect the innocent" so the sizes 
returned etc. may be wrong.

I have verified using the /var/lib/imap/log/${user} directory on the 
server that no other clients are interacting with the folders.

We have a java based mail processor which does the following in an 
infinite loop (code is spring 3.1.4 with integration 2.2.5 and javamail 
1.5.1):

1) search e.g.

> A3 SEARCH NOT (ANSWERED) NOT (DELETED) NOT (SEEN) NOT (KEYWORD spring-integration-mail-adapter) ALL

2) flag the messages, e.g. for each sequence number in the results:

> A9 STORE 1 +FLAGS (spring-integration-mail-adapter)
> A10 STORE 1 +FLAGS (\Seen)

3) fetch the messages e.g. for each sequence number in the results:

> A13 FETCH 1 (BODY.PEEK[]<0.16384>)

4) dispatch the messages to a "worker thread"
5) repeat

If we throw a large number of messages at this (e.g. 250 at once 
generated every .1 second using unix "mail" cmd line is enough to 
trigger), we see the following situation.

Search returns some number of messages, say 119 as in the log.

Each message is flagged and fetched as above.

During this time, 3 or 4 more messages have been delivered, and when the 
next search comes around these messages are somehow already marked as 
Seen, or at least all but one are marked as seen.  (The next search 
returns incorrect number of messages).  In fact, this can be seen before 
the next search is even done based on the output of the "SELECT" which 
shows "UNSEEN 123".  It should be "UNSEEN 120".

Is there some way other than STORE where \Seen gets set?  In the 
attached log you will see basically nothing happens to mark these 
messages Seen.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imap.log
Type: text/x-log
Size: 595845 bytes
Desc: not available
Url : http://lists.andrew.cmu.edu/pipermail/cyrus-devel/attachments/20131211/3465fe9e/attachment-0001.bin 


More information about the Cyrus-devel mailing list