Hi Frank,

On Mon, 11 Apr 2022, at 11:36 PM, Frank Richter wrote:
> I'm still hunting some strange IMAP bugs with Horde Webmail. Users get 
> messages like 'Mailbox structure on server has changed.' 
> 
> This is in code handling UIDVALIDITY (as I understood it) – it's here:
> 
> https://github.com/horde/imp/blob/8d19f07d87a6320df5de6b293ec05a49502005ff/lib/Mailbox.php#L672
> 

If I'm reading this code correctly (someone who actually knows PHP can correct 
me if I'm not), it looks like it's doing something like:

* get the cached uidvalidity
* if there was no cached uidvalidity, set a flag to indicate that this is the 
first time we're caching it
* if the cached uidvalidity does not match the uidvalidity from the server 
(including by not having been previously cached), update the cache to match
* if we've updated the cache, and it wasn't the first time, throw the error

So, any time UIDVALIDITY changes, Horde will throw this error.

UIDVALIDITY is *supposed* to change, from time to time (ideally as rarely as 
possible).  Message UIDs try to be persistent, so clients can cache them.  
UIDVALIDITY stays the same as long as the message UIDs remain the same, but 
changes if the UIDs change.  The hypothetical client caches message UIDs along 
with the UIDVALIDITY, and if it ever gets a *different* UIDVALIDITY back from 
the server, it then knows that its cached UIDs are no longer valid, and 
discards them.  The server tries to keep message UIDs the same, but if it ever 
needs to renumber them for whatever reason, it bumps UIDVALIDITY to indicate it 
has done so.

This is all normal IMAP behaviour.

It's strange that Horde would throw this error up to the user, who probably has 
no idea what it means. IMO they should just discard any now-invalid cached 
UIDs, and carry on as usual.

It's not clear to me whether Horde actually discards its cached UIDs on 
UIDVALIDITY change, like it's supposed to, or whether it just complains to the 
user.

Either way, there's no indication that Cyrus is doing anything wrong in this 
case.  Whatever shape this problem ends up being, it looks like a Horde problem.

Cheers,

ellie
------------------------------------------
Cyrus: Info
Permalink: 
https://cyrus.topicbox.com/groups/info/T25c7531b76d23ba0-M2027d1f75cb88e5ba37c020e
Delivery options: https://cyrus.topicbox.com/groups/info/subscription

Reply via email to