[Yum-devel] Re: threading problem in config.py

Dan Williams dcbw at redhat.com
Wed Mar 22 21:22:33 UTC 2006


On Wed, 2006-03-22 at 14:19 -0500, seth vidal wrote:
> Hey Guys,
>  Dan Williams is spawning off multiple threads of YumBase from within
> plague and he's been running into some problems with some variables in
> the Config class overwriting later threads.
> 
> Specifically the installroot variable seems like it is getting stepped
> on between threads.
> 
> I'm not sure I know what to look for, though, for what could be causing
> the problem.
> 
> 
> Specifically Paul, Menno - Any suggestions on things I should look at?

The specific problem is that installroot is a class attribute on
EarlyConfig rather than an instance attribute , which means that it is
the same across all threads.  That in itself is OK, but the problem
happens in config.py::readMainConfig() when this gets run:

    EarlyConf.installroot.default = root

'root' is specific to the thread, yet the object EarlyConf.installroot
is shared between threads, it being a class attribute initialized on
module load.  The last thread to set installroot.default wins...

It would appear that this isn't unique to EarlyConfig either, since all
the other BaseConfig subclasses use class attributes for options, rather
than instance attributes.

Dan





More information about the Yum-devel mailing list