[ python-Bugs-874900 ] threading module can deadlock after fork
SourceForge.net
noreply at sourceforge.net
Sun Mar 20 13:05:18 CET 2005
Bugs item #874900, was opened at 2004-01-11 16:28
Message generated for change (Comment added) made by tzot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=874900&group_id=5470
Category: Threads
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael McCandless (mikemccand)
Assigned to: Nobody/Anonymous (nobody)
Summary: threading module can deadlock after fork
Initial Comment:
We have a Python HTTP server that, in the parent
process, uses os.fork to spawn new children, but at the
same time the parent could be spawning new threads (in
threads other than the main thread -- only the main
thread does forking).
Anwyay, it very rarely causes deadlock in a spawned
child when that child tries to start a new thread.
I believe I've tracked this down to the
_active_limbo_lock in the threading module.
Specifically, if this lock is held by parent (because
another thread is spawning a thread), just as os.fork
happens, the child inherits the held lock and will then
block trying to do any threading.* operations.
Just like the global interp. lock is overwritten in the
child after fork, I think something similar should
happen to threading._active_limbo_lock? (And more
generally the user needs to be aware of locks passing
through fork; but I think at least threading.py should
"do the right thing").
This thread looks quite relevant:
groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=38E6F2BA.E66CAC90%40ensim.com&rnum=5&prev=/groups%3Fq%3Dpython%2Bfork%2Bthreading%2Bmodule%2B%2Block%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26sa%3DN%26scoring%3Dd
----------------------------------------------------------------------
Comment By: Christos Georgiou (tzot)
Date: 2005-03-20 14:05
Message:
Logged In: YES
user_id=539787
See some more typical info about mixing forks and threads:
http://mail.python.org/pipermail/python-list/2001-September/066048.html
This seems not to be Python-related, but platform-related.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=874900&group_id=5470
More information about the Python-bugs-list
mailing list