Re: Patch: fix concurrent accesses to the imap summary



Hello Philip,

  I'm not doing anything illegal with the sessions. Let me explain
with more details. What I do is basically the following :

  1.tny_folder_get_msg()
  2.tny_folder_remove_msg()
  3.tny_folder_sync()
  4.tny_folder_get_msg()

  The server is a Courier server. The above sequence triggers the following :

  1. tny_folder_get_msg()

Opens the 2nd session, "Get-Message service created"

  2. tny_folder_remove_msg()

sets some flags locally I guess

  3. tny_folder_sync()

(48, 48) -> C00027 UID STORE 1009 +FLAGS.SILENT (\Deleted)
(.., ..) <- C00027 OK STORE completed.
camel_imap_folder_stop_idle
(25, 25) -> C00028 UID EXPUNGE 1009
(.., ..) <- * 7 EXPUNGE
(.., ..) <- * 17 EXISTS
(.., ..) <- * 0 RECENT
(.., ..) <- C00028 OK EXPUNGE completed

so here *message 7* is removed from the summary

  4.tny_folder_get_msg()

Get-Message service reused
(13, 13) -> D00007 NOOP
(.., ..) <- * 7 EXPUNGE
(.., ..) <- * 17 EXISTS
(.., ..) <- * 0 RECENT
(.., ..) <- D00007 OK NOOP completed
...

so here *message 7* is removed from the summary a second time but is
not valid anymore :-(

Do I miss something stupid ?

-- 
Martin



2008/11/20 Philip Van Hoof <spam pvanhoof be>:
>
> ps. A patch that could get approved would be one that locks and unlocks
> the summary file with a flock(2) or fcntl(2). Not a hack like this :(
>
> On Thu, 2008-11-20 at 12:40 +0100, Philip Van Hoof wrote:
>> Creating two sessions like that is not supported and it's not intended
>> that it'll ever be supported. So I can't approve this patch.
>>
>> Note that the IMAP account already creates a new session by its own, for
>> fetching messages. It's not necessary for the client developer to do
>> this himself.
>>
>> Note that this extra session that is internally created is transparent
>> for the application developer and should (or will) consume the summary
>> correctly already.
>>
>>
>> On Thu, 2008-11-20 at 11:50 +0100, Martin Bonnin wrote:
>> > Hello all,
>> >
>> >    Patch is attached. This looks like quite a low-level problem and
>> > I'm not sure this patch is enough for all cases. But at least it fixes
>> > one instance of the problem (removing on the server then fetching a
>> > new message).
>> >
>> >    Changelog:
>> >     For IMAP, we open 2 sessions: one for standard operations, the other
>> >     for fetching messages. This makes concurrent accesses to the folder summary
>> >     therefore corrupting it.
>> >     This happens e.g when you delete a message and fetch a new one afterwards.
>> >     This patch adds the "dont_touch_summary" parameter to prevent the
>> > GetMsg session to
>> >     mess up too much.
>> >
>> > _______________________________________________
>> > tinymail-devel-list mailing list
>> > tinymail-devel-list gnome org
>> > http://mail.gnome.org/mailman/listinfo/tinymail-devel-list
> --
> Philip Van Hoof, freelance software developer
> home: me at pvanhoof dot be
> gnome: pvanhoof at gnome dot org
> http://pvanhoof.be/blog
> http://codeminded.be
>
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]