On Thu, 8 Jul 2004, Kyle Wheeler wrote: >On Tue, Jul 06, 2004 at 10:57:14AM -0500, Kyle Wheeler quoth: >> > Any luck when testing with 1.2.9beta1? >No problems on my end, and none reported by any of my users. I call this >bug squashed! Thanks!
Har har har! The problem was caused by a little piece of code that handled the case where two instances of Binc IMAP accessed the same Maildir. Just for the archives, and so I remember it later: If one instance detects a new message and then expunges it before the other client ever sees it, then the cache file is the only way of communicating the existance of this message across the instances. For UID delegation, the UIDNEXT value must be communicated. Now, the actual deleting of the message is done before the scan lock is acquired (Binc IMAP only locks the mailbox in one occasion - when the UIDs are delegated - there is no known way around this conceptual problem). So there is a gap in time where a message still exists in / has not been removed from the cache file, but is gone from the file system. In this case, a concurrent client must not store this message in memory. Rather, after having added it to memory because it read about it in the cache file during a scan, it has to remove it afterwards if it doesn't exist. To keep track of what messages were just discovered in the cache file, a message flag called F_JUSTARRIVED is set. This is to prevent the message arrival and expunge from being reported. If the message is in the cache file and does exist in the mailbox, then in a later scan doesn't exists in the mailbox anymore, then the F_EXPUNGED message flag is set. Binc IMAP failed to _clear_ the F_JUSTARRIVED flag in the mailbox scan after reading the cache and removing all expunged entries from memory. This introduced a race condition, as all messages that arrived in the current session would have this flag set throughout the session. If these messages were suddenly gone from the mailbox, then they would be silently removed from memory instead of reported as expunged, because of the F_JUSTARRIVED flag. Complicated problem, simple fix. The flag is now cleared. Andy :-) -- Andreas Aardal Hanssen | http://www.andreas.hanssen.name/gpg Author of Binc IMAP | "It is better not to do something http://www.bincimap.org/ | than to do it poorly."
