Timo,

On Wed, Mar 13, 2019, at 9:36 AM, Kostya Vasilyev wrote:
Timo,

On Wed, Mar 13, 2019, at 12:39 AM, Timo Sirainen wrote:
On 12 Mar 2019, at 10.21, Kostya Vasilyev via dovecot <dovecot@dovecot.org> wrote:

It makes no difference if the IDLE connection does SELECT or SELECT (CONDSTORE) prior to going IDLE.

But then as far as I know (?) - in Dovecot, once any connection uses CONDSTORE ever, even once, Dovecot creates data structures to track MODSEQ values, and those data structures are forever.
So are you saying that you can reproduce if you do for a completely new user:

doveadm exec imap -u testuser1
a select inbox
b idle

And then run:
echo foo | doveadm save -u testuser1
doveadm flags add -u testuser1 '\Seen' mailbox inbox 1

And the EXISTS shows up immediately after saving, but the flag change won't show up? It works fine with me.

Do you see any errors in "doveadm log errors"? Can you reproduce this if you try with some other mailbox format than mbox?


1 - Yes I was able to reproduce with a completely new user.

I didn't use your doveadm commands above, but created a new Linux user in group mail, set a password in /etc/dovecot/users, and sent a few emails to that user from another mail account / web mail. My SMTP server is Postfix.

Then I used my IDLE client code (which does SELECT CONDSTORE) and a separate netcat connection to make flags changes.

Same thing as before: 1) no flags changes flushed to IDLE 2) until the other connection (which changed flags) does a SELECT.

The only difference from before -  it was enough for netcat to do plain SELECT (i.e. SELECT CONDSTORE was not necessary).

I also tried a netcat connection instead of "my IDLE client" and did plain SELECT before going IDLE (i.e. SELECT without CONDSTORE). Same thing: 1) delay 2) flags changes are flushed after the other connection does SELECT.

2 - I switched to Maildir last night - and the problem stopped for same old existing user.

So it looks triggered by a combination of mbox + SELECT (CONDSTORE)?

3 - No errors in doveadm log errors

4 - /var/log/mail.err has this

Mar 13 09:21:17 kman dovecot: auth: Error: Master requested auth for nonexistent client 29548 (created 0 msecs ago, handshake 0 msecs ago)
Mar 13 09:21:18 kman dovecot: imap-login: Error: net_connect_unix(/var/run/dovecot/stats-writer) failed: No such file or directory

Probably means nothing - I tried to log in with IMAP before remembering to add my new user to /etc/dovecot/users

-- K


One more test with this new "test" user.

I'd stopped postfix and dovecot, deleted this user's mail in /var/mail/%u and ~%u/mail and started over. Still mbox format.

This time I used netcat for the IDLE connection, plain SELECT without CONDSTORE.

Flags changes were sent quickly.

Then on the IDLE connection I sent DONE and SELECT Inbox (CONDSTORE) - without logging out or closing the connection.

The issue started again.

I also learned that it's enough for the "other" (non-idle, flag changing) connection to do just "tag SELECT" - i.e. without mailbox name - which results in

* OK [CLOSED] Previous mailbox closed.
tag BAD Error in IMAP command SELECT: Invalid arguments (0.001 + 0.000 secs).

but also does send the buffered up FLAGS changes on the IDLE connection.

Hope these are useful data points.

-- K