MBOX-Line: From kmansoft at gmail.com  Wed Mar 25 12:00:37 2015
To: imap-protocol@u.washington.edu
From: Kostya Vasilyev <kmansoft@gmail.com>
Date: Fri Jun  8 12:34:54 2018
Subject: [Imap-protocol] Gmail flags issue, timing-sensitive
In-Reply-To: <CAN7dqjAxtu=k65vF-gshYYiEdMVeJ_j_ZruB2RLQRHTxouRckA@mail.gmail.com>
References: <CAN7dqjCYRb2sbOZS49hiqgrSsfKFTzyT-b5fKHm0U4mBGvDRzA@mail.gmail.com>
	<CABa8R6t01i4CMumftDbTdY_xC7WYWLCmh7__Qg+zrsw8dZxHwA@mail.gmail.com>
	<CAN7dqjAxtu=k65vF-gshYYiEdMVeJ_j_ZruB2RLQRHTxouRckA@mail.gmail.com>
Message-ID: <CAN7dqjBcK_UZ1uYcT-G=a7N7W=g_JoAXf=kHSL6sz9EmMtc-9g@mail.gmail.com>

[ With a new apology to list members who'd prefer not seeing any Gmail
specific stuff ]

Here is another case of Gmail and flags being weird.

Hoping it gets fixed too.

A message already has \Answered and \Seen, trying to add \Flagged.

Folder was selected with CONDSTORE.

New state reported without \Answered first (wrong), then with it (right),
and the MODSEQ is the same (which is also wrong).

21:54:31.077 [IMAP.5800] Sending: kman25 UID STORE 196290 +FLAGS (\Flagged)
21:54:31.672  [IMAP_RAW.5800] Data is <167>:
21:54:31.672  * 20927 FETCH (FLAGS (\Flagged \Seen) MODSEQ (20736711) UID
196290)
21:54:31.672 * 20927 FETCH (UID 196290 MODSEQ (20736711) FLAGS (\Answered
\Flagged \Seen))
21:54:31.672  kman25 OK Success

-- K

2015-03-25 19:17 GMT+03:00 Kostya Vasilyev <kmansoft@gmail.com>:

> Thank you Brandon.
>
> Any way for me or other mail app developers to keep up on how it goes from
> there?
>
> Scenario involving IDLE -- what I saved for later in my original message
> -- looks like this:
>
> Worker connection doing +\Seen:
> 01:45:58.791: [IMAP.4580] Sending: kman12 UID STORE 196235 +FLAGS (\Seen)
> 01:45:59.442: [IMAP_RAW.4580] Data is <98>:
> 01:45:59.442: * 20885 FETCH (FLAGS (\Seen) UID 196235)
> 01:45:59.442: * 20885 FETCH (UID 196235 FLAGS ())
> 01:45:59.442: kman12 OK Success
>
> Separate IDLE connection (or conceivably, different device), no \Seen:
>
> 01:45:59.977: [IMAP.4572] Data is <37>:
> 01:45:59.977: * 20885 FETCH (UID 196235 FLAGS ())
>
> Worker connection again:
>
> 01:46:05.046: [IMAP.4580] Sending: kman15 UID STORE 196235 +FLAGS
> (\Answered)
>
> IDLE  connection again, while above command is still executing: no \Seen
> and no \Answered. That's the only data ever received there. So it only get
> data that's obsolete, and then nothing more on that message:
>
> 01:46:05.890: [IMAP.4572] Data is <34>:
> 01:46:05.890: * 20885 FETCH (UID 196235 FLAGS ()
>
> Worker connection, command finally done, obsolete state of flags as well:
>
> 01:46:05.896: [IMAP_RAW.4580] Data is <108>:
> 01:46:05.896: * 20885 FETCH (FLAGS (\Answered \Seen) UID 196235)
> 01:46:05.896: * 20885 FETCH (UID 196235 FLAGS ())
> 01:46:05.896: kman15 OK Success
>
> And as a sanity check, same issue is also exhibited in Trojita (Linux
> desktop).
>
> 1 - removing "star" from a message, message in the UI stays "starred":
>
> 18:15:27.666 >>> y105 UID STORE 196275 -FLAGS (\Flagged)??
> 18:15:27.830 <<< y104 OK IDLE terminated (Success)??
> 18:15:28.254 <<< * 20916 FETCH (FLAGS (\Seen) MODSEQ (20734317) UID
> 196275)??
> 18:15:28.254 <<< * 20916 FETCH (UID 196275 MODSEQ (20734310) FLAGS
> (\Flagged \Seen))??
> 18:15:28.260 <<< y105 OK Success??
>
> 2 - Opening a freshly received message (same scenario as my original
> message), message in the UI stays unread:
>
> 18:16:31.950 >>> y109 UID STORE 196276 +FLAGS (\Seen)??
> 18:16:31.950 >>> y110 UID FETCH 196276 (BODY.PEEK[1])??
> 18:16:32.652 <<< * 20917 FETCH (FLAGS (\Seen) MODSEQ (20734373) UID
> 196276)??
> 18:16:32.652 <<< * 20917 FETCH (UID 196276 MODSEQ (20734328) FLAGS ())??
> 18:16:32.657 <<< y109 OK Success??
> 18:16:32.657 Imap::Mailbox::UpdateFlagsTask Completed
> 18:16:32.663 <<< * 20917 FETCH (UID 196276 MODSEQ (20734328) BODY[1]
> {13060}??PGRpdj6aPC9kaXY+PGRpdj48ZGl2PjxkaXYgc3R5bGU9ImNvbG9yOmJsYWNrOyI+PGRpdiBzdHls??ZT0iY29sb3I6YmxhY2s7Ij48cCBzdHlsZT0iY29sb3I6YmxhY2s7Zm9udC1za
> (+ 12924 more bytes)
> 18:16:32.663 <<< y110 OK Success??
>
> Trojita uses CONDSTORE, so it should be possible to filter responses and
> take the one with the largest MODSEQ, but...
>
> ... I've already tried that in my app, and it doesn't help with wrong data
> on IDLE connections, and also doesn't help when you have multiple devices.
>
> -- K
>
>
> 2015-03-25 18:43 GMT+03:00 Brandon Long <blong@google.com>:
>
>> I'll file a bug
>> On Mar 25, 2015 7:55 AM, "Kostya Vasilyev" <kmansoft@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I apologize for a Gmail specific message, but for lack of a better
>>> place...
>>>
>>> Recently I've started seeing strange stuff with message flags, the Gmail
>>> IMAP server returns out of date information on STORE +FLAGS and IDLE
>>> connections.
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman13.u.washington.edu/pipermail/imap-protocol/attachments/20150325/59abd08e/attachment.html>
