CFT: fix OfflineIMAP lockup in single-threaded mode

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


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

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
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:
    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.

On Mon, Jan 28, 2013 at 8:46 PM, Eygene Ryabinkin <rea at> 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,
> I expect that Cyril will review it, I had posted an answer to his
> comments,
> The second one, that adds singleton options depot,
> 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,
> In the current form relies on the previous patch.
> --
> rea
> _______________________________________________
> OfflineIMAP-project mailing list
> OfflineIMAP-project at
> OfflineIMAP homepage:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the OfflineIMAP-project mailing list