Re: Serious problems with multiple connections working with the same mailbox

Jerry Lundström <[email protected]> Fri, 23 Sep 2005 10:08:52 +0200
Newsgroups gmane.mail.imap.binc.devel
Message-ID <[email protected]>
Andreas Aardal Hanssen wrote:
> On Tue, 20 Sep 2005, [ISO-8859-1] Jerry Lundström wrote:
> 
>>We are now running tests on this patch and if no apparent problems occur
>>within 2-3 days this patch will go live on our system and it will go into
>>binc-1.2.14beta2.
> 
> Unless you see problems without this change, and can point to the RFC
> about where this code breaks anything, please revert it.

I don't follow you on that sentence, there is problems without this change.

The problem is that the UID STORE command didnt update the in-memory 
cache before trying to do what the client asked. So that if you have two 
connections opened at the same time, one that you do status in and get a 
new UID you will not be able to use STORE on the other connections.

This is how MacOS X 10.3/10.4 Mail and Outlook/Outlook Express handles 
marking mail read.

The logical problem is that only pendingUpdate or a direct call to scan 
updates the in-memory cache of binc and pendingUpdate are most always 
called at the end of the operation.

Here is a short example:

1: TAG select "INBOX"
1: * 610 EXISTS
1: * 0 RECENT
1: * OK [UIDVALIDITY 1116849887]
1: * OK [UIDNEXT 1216] 1216 is the next UID
1: * FLAGS (\Answered \Flagged \Deleted \Recent \Seen \Draft)
1: * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft)] Limited
1: TAG OK [READ-WRITE] SELECT completed

2: TAG SELECT "INBOX"
2: * 610 EXISTS
2: * 0 RECENT
2: * OK [UIDVALIDITY 1116849887]
2: * OK [UIDNEXT 1216] 1216 is the next UID
2: * FLAGS (\Answered \Flagged \Deleted \Recent \Seen \Draft)
2: * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft)] Limited
2: TAG OK [READ-WRITE] SELECT completed

1: TAG NOOP
1: * 611 EXISTS
1: TAG OK NOOP completed
1: TAG FETCH 611 FLAGS
1: * 611 FETCH (FLAGS ())
1: TAG OK FETCH completed

2: TAG FETCH 611 FLAGS
2: * 611 EXISTS
2: TAG OK FETCH completed

And no, I can not see anothing specific in the RFC that says this should 
not be possible or that it should be possible.

-- 
Jerry Lundström, System Developer
Section for IT and Media, Stockholms University, Sweden
+46 (0)8 16 19 99 / http://www.it.su.se