CFT: fix OfflineIMAP lockup in single-threaded mode

X Ryl boite.pour.spam at gmail.com
Mon Jan 28 20:37:18 GMT 2013


Eygene,

I'm ok with the first patch, but I would merge it with the last one, and
update the part that read:

 if self.suggeststhreads() and self.config.get('general',
'single-thread') == 'False':

to simply this:

 if self.suggeststhreads():

suggeststhreads() should do the self.config.get uglyness in this patch, so
it's self sufficient (one can apply it and does not depend on any later
patch).

Then, the depot/Option part, if you don't mind, need a bit a work, before
being applied:
If I understand what you're doing, your Singleton class has a static dict
member called "__options", and each time you need to check for an "option",
you create an instance of the Option class that simply refer to this static
dictionnary.
This is, a bit unusual. If one changes the Option() instance, it's only
local, as a static member change make it instance member, right ?
In that case, it's not const (read only). In the same module, a change of
the option variable would still work, so it won't break as soon as you're
changing it (but at least it'll not break the other modules) .

You probably meant this:

# Put in const.py...:class _const:
    class ConstError(TypeError): pass
    def __setattr__(self,name,value):
        if self.__dict__.has_key(name):
            raise self.ConstError, "Can't rebind const(%s)"%name
        self.__dict__[name]=valueimport syssys.modules[__name__]=_const()


And it'd be used as this:

import const# and bind an attribute ONCE:const.singlethread = True;

# else it fails:const.singlethread = False; # raise const.ConstError:



Let me know if I understand correctly, so we can have a better
implementation of the "depot" idea. I find the idea of a global "depot"
more interesting than instantiating a new object each time needed.
Then we would again update the suggestthreads() to use the depot
(const)option object directly.

Regards,
Cyril
On Mon, Jan 28, 2013 at 8:46 PM, Eygene Ryabinkin <rea at codelabs.ru> wrote:

> Mon, Jan 28, 2013 at 05:10:50PM +0100, Nicolas Sebrecht wrote:
> > On Mon, Jan 28, 2013 at 02:10:57AM +0400, Eygene Ryabinkin wrote:
> > > Sun, Jan 27, 2013 at 08:39:13PM +0100, Nicolas Sebrecht wrote:
> >
> > > > So, about this subtle and critical topic I'd say it's fine to go
> step by
> > > > step. This would prevent from non-required headaches and could later
> > > > help to distinguish newly introduced issues coming from the "core"
> fix
> > > > and the "polishing" commit.
> > >
> > > Well, I had missed this paragraph while I was polishing my commit.
>  Will
> > > split it into two tomorrow.
> >
> > There is no requirements for two commits either. ,-)
>
> But it will really be good, so here we go.  The first patch,
>
> http://codelabs.ru/patches/offlineimap/2012-preliminary-fix-deadlock-singlethreaded-IMAP-sync.diff
> I expect that Cyril will review it, I had posted an answer to his
> comments,
>   https://github.com/OfflineIMAP/offlineimap/issues/22
>
>
> The second one, that adds singleton options depot,
>
> http://codelabs.ru/patches/offlineimap/2013-use-singleton-depot-for-passing-options.diff
> Cyril had some comments, I had some answers.  Will see tomorrow.
>
> Small patch that disables IMAP suggestion to use multithreaded operations
> if we're in single-threaded mode,
>
> http://codelabs.ru/patches/offlineimap/2013-IMAP-dont-suggest-multithreading-in-singlethreaded-mode.diff
> In the current form relies on the previous patch.
> --
> rea
>
> _______________________________________________
> OfflineIMAP-project mailing list
> OfflineIMAP-project at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/offlineimap-project
>
> OfflineIMAP homepage: http://software.complete.org/offlineimap
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20130128/44e4a9cc/attachment-0003.html>


More information about the OfflineIMAP-project mailing list