[Pulp-list] pulp threading

Jeff Ortel jortel at redhat.com
Mon Jun 6 15:46:21 UTC 2011


All,

In tasking/thread.py:99 we are replacing Thread class with our own:

<snip>
# monkey-patch the threading module in order to track threads
# this allows us to cancel tasks that have spawned threads of their own
threading.Thread = TrackedThread
</snip>

Although, I don't see anything in the TrackedThread class or in this module that would 
directly cause problems, I have concerns about tampering with the core python threading 
module.  It appears that the purpose for doing this is to add support for cancelling 
(killing) threads primarily in support of our task subsystem.  Since TaskThread already 
extends TrackedThread, I don't see any advantage to modifying the threading module 
(although I could be missing something).  Replacing the Thread class in the threading 
module potentially affects all threads such as those spawned by QPID, gofer, grinder and 
perhaps mod_wsgi itself which may be having unintended side effects.

Since we are seeing weirdness wrt threading/locking while running within mod_wsdi, I 
suggest that unless reassigning the Thread class within the threading module is absolutely 
essential to tasking, that we remove the above code snip.  Again, the code involved here 
doesn't seem to do anything bad but if nothing else, I'd like to remove it as a possible 
cause.

Comments?

-jeff




More information about the Pulp-list mailing list