classification
Title: multiprocess.Queue operations during import can lead to deadlocks
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.1
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: jnoller Nosy List: asksol, brett.cannon, jnoller, kripken
Priority: normal Keywords: needs review, patch

Created on 2010-01-15 16:35 by kripken, last changed 2010-11-05 14:53 by jnoller.

Files
File name Uploaded Description Edit
test.py kripken, 2010-01-15 16:35 test cases
multiprocessing-issue7707.patch asksol, 2010-09-22 19:19
Messages (4)
msg97820 - (view) Author: Alon Zakai (kripken) Date: 2010-01-15 16:35
Creating a multiprocessing.Queue and operating on it while being imported can lead to a deadlock.

The attached file will work if run directly (python test.py) but will hang if imported from the interpreter (import test).

Additional comments are in the file.
msg97846 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2010-01-15 21:10
Without looking at the multiprocessing code I am willing to guess that some code in that run() function is launching some code that runs in a thread that is performing an import, deadlocking on the import lock. Jesse, is that what could be happening? If so we should probably add a note to the multiprocessing docs to not do this sort of stuff, ala http://docs.python.org/library/threading.html#importing-in-threaded-code .
msg117151 - (view) Author: Ask Solem (asksol) (Python committer) Date: 2010-09-22 19:19
I created a small doc patch for this (attached).
msg120504 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2010-11-05 14:53
Fine w/ committing this Ask.
History
Date User Action Args
2010-11-05 14:53:20jnollersetmessages: + msg120504
2010-09-22 19:19:58asksolsetfiles: + multiprocessing-issue7707.patch
versions: + Python 3.1, - Python 2.6
nosy: + asksol

messages: + msg117151

keywords: + needs review, patch
2010-01-15 21:10:43brett.cannonsetassignee: jnoller
messages: + msg97846
2010-01-15 17:26:15r.david.murraysetnosy: + brett.cannon, jnoller
2010-01-15 16:35:13kripkencreate