[Dovecot] mysteriously disappearing RECENT flag
Hello,
I've decided to switch from UW-IMAP to Dovecot and so installed 1.0.rc15-2 on a Debian/Etch system and started using it with the existing MBOX folders. My configuration is pretty much the default one, in particular I didn't touch to any of mbox_xxx options.
The (hoped for) performance improvements were indeed quite noticeable and mostly it works just fine but I seem to have one strange problem with the recent messages: Dovecot seems to reset the RECENT flag on the message right *before* the mailbox is opened. So even if a message was just copied to a folder (e.g. by email client filtering), it doesn't have RECENT flag when the mailbox is opened. Here is an example of what I see:
% telnet localhost 143 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'.
- OK [CAPABILITY IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS STARTTLS AUTH=PLAIN] Dovecot ready. 1 login user password 1 OK Logged in. 2 status test (messages recent unseen)
- STATUS "test" (MESSAGES 41 RECENT 0 UNSEEN 0) 2 OK Status completed. [--- switch to another window and copy a message to the test folder ---] 3 status test (messages recent unseen)
- STATUS "test" (MESSAGES 42 RECENT 1 UNSEEN 0) 3 OK Status completed. 4 select test
- FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
- OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
- 42 EXISTS
- 0 RECENT
- OK [UIDVALIDITY 1048987099] UIDs valid
- OK [UIDNEXT 407] Predicted next UID 4 OK [READ-WRITE] Select completed. 5 status test (messages recent unseen)
- STATUS "test" (MESSAGES 42 RECENT 0 UNSEEN 0) 5 OK Status completed. 6 fetch 42 flags
- 42 FETCH (FLAGS (\Seen)) 7 logout
- BYE Logging out 7 OK Logout completed. Connection closed by foreign host.
Why does Dovecot send "0 RECENT" when the mailbox is opened when it had just told that there was a recent message in it? And why is the message effectively old (no \Recent in the FETCH reply)? Notice that if I look at the MBOX file I see "Status: R" until command number 7, it becomes "Status: RO" only when I log out -- but internally Dovecot clearly considers it to be old long before that.
Am I doing something wrong? Or is this the expected behaviour and, in this case, is there any way to change it to the more expected one (UW-IMAP-like)?
Thanks in advance, VZ
On Mon, 2007-01-22 at 17:38 +0100, Vadim Zeitlin wrote:
- STATUS "test" (MESSAGES 41 RECENT 0 UNSEEN 0) 2 OK Status completed. [--- switch to another window and copy a message to the test folder ---]
Copied using what program? Did it add X-UID or Status header?
3 status test (messages recent unseen)
- STATUS "test" (MESSAGES 42 RECENT 1 UNSEEN 0) 3 OK Status completed.
If you do it again, does it still show RECENT 1?
Why does Dovecot send "0 RECENT" when the mailbox is opened when it had just told that there was a recent message in it? And why is the message effectively old (no \Recent in the FETCH reply)? Notice that if I look at the MBOX file I see "Status: R" until command number 7, it becomes "Status: RO" only when I log out -- but internally Dovecot clearly considers it to be old long before that.
That is because it's using "lazy writes". You could try if setting mbox_lazy_writes=no changes anything.
Am I doing something wrong? Or is this the expected behaviour and, in this case, is there any way to change it to the more expected one (UW-IMAP-like)?
It should work like that. I just tested the exact same method you described, and SELECT showed 1 RECENT.
On Mon, 22 Jan 2007 18:55:33 +0200 Timo Sirainen tss@iki.fi wrote:
Thanks for the fast reply Timo!
TS> On Mon, 2007-01-22 at 17:38 +0100, Vadim Zeitlin wrote: TS> > * STATUS "test" (MESSAGES 41 RECENT 0 UNSEEN 0) TS> > 2 OK Status completed. TS> > [--- switch to another window and copy a message to the test folder ---] TS> TS> Copied using what program? Did it add X-UID or Status header?
Copied using my own MUA (Mahogany) which uses c-client library and is connected to the same (Dovecot) IMAP server, so the message is appended by Dovecot itself. It does have X-UID and "Status: R" headers but I thought they were appended by Dovecot itself, aren't they?
TS> > 3 status test (messages recent unseen) TS> > * STATUS "test" (MESSAGES 42 RECENT 1 UNSEEN 0) TS> > 3 OK Status completed. TS> TS> If you do it again, does it still show RECENT 1?
Yes. I did find a mention of an old (2003) bug which resulted in recent flag being unset after status command but it was apparently fixed a long time ago and, anyhow, status works just fine -- the problem only arises when the folder is opened.
TS> > Why does Dovecot send "0 RECENT" when the mailbox is opened when it had TS> > just told that there was a recent message in it? And why is the message TS> > effectively old (no \Recent in the FETCH reply)? Notice that if I look at TS> > the MBOX file I see "Status: R" until command number 7, it becomes "Status: TS> > RO" only when I log out -- but internally Dovecot clearly considers it to TS> > be old long before that. TS> TS> That is because it's using "lazy writes". You could try if setting TS> mbox_lazy_writes=no changes anything.
Well, yes, it does! This fixed the problem. I can live with this option being turned on, of course, but I'm still curious as to why it helped. It looks like some information is not being updated correctly somewhere if the file is not rewritten on disk immediately.
Anyhow, thanks for the hint about mbox_lazy_writes and I'd be glad to help you to debug the problem further if you're interested. Please let me know if you have any ideas about what would you like me to try (I can provide the full log of the IMAP session which copies the message too if this could be useful).
Thanks, VZ
On Mon, 2007-01-22 at 21:04 +0100, Vadim Zeitlin wrote:
On Mon, 22 Jan 2007 18:55:33 +0200 Timo Sirainen tss@iki.fi wrote:
Thanks for the fast reply Timo!
TS> On Mon, 2007-01-22 at 17:38 +0100, Vadim Zeitlin wrote: TS> > * STATUS "test" (MESSAGES 41 RECENT 0 UNSEEN 0) TS> > 2 OK Status completed. TS> > [--- switch to another window and copy a message to the test folder ---] TS> TS> Copied using what program? Did it add X-UID or Status header?
Copied using my own MUA (Mahogany) which uses c-client library and is connected to the same (Dovecot) IMAP server, so the message is appended by Dovecot itself. It does have X-UID and "Status: R" headers but I thought they were appended by Dovecot itself, aren't they?
Oh, so you were basically appending a new message in another connection.
Anyhow, thanks for the hint about mbox_lazy_writes and I'd be glad to help you to debug the problem further if you're interested. Please let me know if you have any ideas about what would you like me to try (I can provide the full log of the IMAP session which copies the message too if this could be useful).
Yes, I could take a look at all the IMAP sessions. And I suppose you haven't disabled index files? You could also try if you can reproduce this with:
Try appending :INDEX=MEMORY to mail_location. Does it change anything?
If 1) fixes it, does just deleting the index files first fix it?
The way I was testing it was:
a: telnet localhost 143, 1 login user pass a: 2 status inbox (messages recent) b: telnet localhost 143, 3 login user pass b: 4 append inbox {11} b: From: foo (enter enter) a: 5 status inbox (messages recent) a: 6 select inbox
Does that reproduce it?
participants (2)
-
Timo Sirainen
-
Vadim Zeitlin