This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: import deadlocks when using fork
Type: crash Stage:
Components: None Versions: Python 2.4
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Ringding, abaron, apevec, benjamin.peterson
Priority: normal Keywords:

Created on 2009-05-03 11:50 by abaron, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg87044 - (view) Author: ayal baron (abaron) Date: 2009-05-03 11:50
While running 2 or more threads, if one thread is importing anything
(i.e. has the import lock) and the other thread runs fork and then the
child process runs import then the child and parent will hang forever
(the child waits on the import lock but the parent receives the signal).
see Issue1590864 for another example of this.
Following is a simple way to reproduce this behavior:
import time
import os
import threading
import subprocess
class F(threading.Thread):
	def run(self):
		import mysleep
		print "f is out"
f = F()
a =["echo", "DONE"])
print "exit"
msg87737 - (view) Author: Alan Pevec (apevec) Date: 2009-05-14 13:31
Issue is not reproducible with python 2.5, following patch fixes it on
python 2.4:

--- 2009-05-14 12:54:08.000000000 +0000
+++ 2009-05-14 13:06:21.000000000 +0000
@@ -351,8 +351,8 @@


+from errno import ENOENT, ENOTDIR
 def _execvpe(file, args, env=None):
-    from errno import ENOENT, ENOTDIR

     if env is not None:
         func = execve
msg87747 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-05-14 17:24
2.4 is no longer supported.
Date User Action Args
2022-04-11 14:56:48adminsetgithub: 50162
2009-05-14 17:24:19benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg87747

resolution: out of date
2009-05-14 13:31:42apevecsetnosy: + apevec

messages: + msg87737
versions: - Python 2.6, Python 2.5
2009-05-05 08:17:57Ringdingsetnosy: + Ringding
2009-05-03 11:50:27abaroncreate