[Python-Dev] Useful thread project for 2.5?
Tim Peters
tim.peters at gmail.com
Fri Mar 4 22:01:42 CET 2005
Florent Guillaume recently wrote a valuable addin for Zope:
http://www.zope.org/Members/nuxeo/Products/DeadlockDebugger
When a Zope has threads that are hung, this can give a report of
Python's current state (stack trace) across all threads -- even the
ones that are hung (the deadlocked threads don't have to cooperate).
The same flavor of thing would (of course) be handy outside of Zope
too -- debugging deadlocked Python threads is a PITA regardless of
context.
Florent's DeadlockDebugger in turn builds on an external C threadframe module:
http://www.majid.info/mylos/stories/2004/06/10/threadframe.html
Folding the functionality of that (or similar functionality) into the
core would, IMO, be a valuable addition for 2.5, and would make an
excellent intro project for an aspiring contributor interested in how
threads work in CPython (what this module does is conceptually
simple). It belongs in the core because it's not safe to chase the
tstate chain without holding pystate.c's internal head_mutex lock
(holding the GIL isn't enough -- it's normal practice to call
PyThreadState_Delete() while not holding the GIL).
I'd do it myself (and maybe I will anyway), but this really would make
a good (finite; conceptually simple) project for someone who wants to
gain Python developer experience.
More information about the Python-Dev
mailing list