[dev] [PATCH] ActiveSync: Fix email sync error on corner case

Michael J Rubinsky mrubinsk at horde.org
Thu Dec 12 17:18:01 UTC 2013


Quoting Thomas Jarosch <thomas.jarosch at intra2net.com>:

> On Thursday, 12. December 2013 11:23:26 Michael J Rubinsky wrote:
>> Quoting Thomas Jarosch <thomas.jarosch at intra2net.com>:
>> > On Thursday, 12. December 2013 17:11:01 Thomas Jarosch wrote:
>> >> Hmm. What about the array_diff() call in setSoftDeleted()?
>> >> I think it will destroy the array values.
>> >
>> > ah, forget about that, it's not executed for NON-CONDSTORE servers.
>> > Guess it must be something similar though.
>>
>> Yeah. The only other place that $this->_messages is mangled is in
>> updateState(), and it at least *looks* correct to me...
>>
>> I think that the data structure is rather a side effect of the
>> exception being thrown, and not the cause. If you look at
>> setChanges(), the exception is thrown before the $flags are dealt
>> with, so when updateState() is called, $flags are empty when it's
>> combined with $this->_messages.
>
> Sounds like a possibility. ActiveSync_State_Base::getChanges() calls
> getServerChanges(). If we are not pinging the folder, we call
> $folder->updateState() later on.
>
> When an Horde_Exception is thrown in getServerChanges(),
> we just catch it and return an empty changes array.
> Still we are executing $folder->updateState().
>
> What about some kind of race condition: A new message / just deleted message
> is not listed in $this->_messages, but part of the $messages list given to
> setChanges(). We'll then throw the exception and kill the flags
> later on in updateState().

If it's a new message, the UID would be greater than the previous  
UIDNEXT value, so it would be treated as a new message and added to  
the $_messages array. Even if it was removed in the small time between  
we received the message list and called setChanges(), it  
wouldn't/shouldn't matter. The only way I can see this happening is if  
the UIDNEXT values was incorrect, or somehow a message with a UID  
lower than the already existing lowest on the device is provided to  
setChanges().
-- 
mike

The Horde Project (www.horde.org)
mrubinsk at horde.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5849 bytes
Desc: S/MIME Signature
URL: <http://lists.horde.org/archives/dev/attachments/20131212/2dc8ca5a/attachment-0001.bin>


More information about the dev mailing list