One more data point Timo:

On Tue, Mar 12, 2019, at 9:58 AM, Kostya Vasilyev via dovecot wrote:
Timo,

On Tue, Mar 12, 2019, at 3:56 AM, Timo Sirainen via dovecot wrote:
On 10 Mar 2019, at 10.14, Kostya Vasilyev via dovecot <dovecot@dovecot.org> wrote:

My mail is stored under ~/mail/.imap (not sure what this format is called), I mean not "single file mbox".

I have not changed any IDLE related config settings:

doveconf  | grep -i idle
default_idle_kill = 1 mins
director_ping_idle_timeout = 30 secs
imap_idle_notify_interval = 2 mins
imapc_max_idle_time = 29 mins
mailbox_idle_check_interval = 30 secs

What can I do to make Dovecot notify IDLE clients about flags changes - more quickly? Preferably near-instant?

It should simply just work, assuming there aren't any weird inotify limits, but you should get errors logged about reaching those. You could see if it makes any difference to set mailbox_idle_check_interval=1s


mailbox_idle_check_interval = 1 secs

did not help

Here is an interesting case

- Let's say I have my IDLE connection.

- Connection "A" - an email app where I set or clear \Flagged on two messages.

The IDLE connection is silent (no unsolicited notifications about these flags).

- Connection "B" - an email app where I do a refresh - it does a SELECT (CONDSTORE) followed by FETCH UID FLAGS CHANGEDSINCE (because it sees that there are only flags changes).

---> the IDLE connection is notified about flags changes immediately right as Connection "B" is pulling its changes.

I tried a direct network connection (netcat) instead of Connection "B" and the actual trigger is SELECT (CONDSTORE).

- Start up IDLE connection

- Use Connection "A" to make flags changes
 
( IDLE connection is silent )

- Use a netcat connection to SELECT (CONDSTORE)

Dovecot flushes flags to the IDLE connection immediately

- Doing SELECT (without CONDSTORE) does not

Looks like some sort of bug in Dovecot related to CONDSTORE?

This can probably be reproduced with several direct network connections using netcat / openssl s_client - and CONDSTORE seems to be an important part of the scenario.

Ideas?

-- K

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.

-- K