Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import deadlocks when using fork #50162

Closed
abaron mannequin opened this issue May 3, 2009 · 3 comments
Closed

import deadlocks when using fork #50162

abaron mannequin opened this issue May 3, 2009 · 3 comments
Labels
type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@abaron
Copy link
Mannequin

abaron mannequin commented May 3, 2009

BPO 5912
Nosy @benjaminp

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-05-14.17:24:19.669>
created_at = <Date 2009-05-03.11:50:27.836>
labels = ['type-crash']
title = 'import deadlocks when using fork'
updated_at = <Date 2009-05-14.17:24:19.659>
user = 'https://bugs.python.org/abaron'

bugs.python.org fields:

activity = <Date 2009-05-14.17:24:19.659>
actor = 'benjamin.peterson'
assignee = 'none'
closed = True
closed_date = <Date 2009-05-14.17:24:19.669>
closer = 'benjamin.peterson'
components = ['None']
creation = <Date 2009-05-03.11:50:27.836>
creator = 'abaron'
dependencies = []
files = []
hgrepos = []
issue_num = 5912
keywords = []
message_count = 3.0
messages = ['87044', '87737', '87747']
nosy_count = 4.0
nosy_names = ['benjamin.peterson', 'Ringding', 'abaron', 'apevec']
pr_nums = []
priority = 'normal'
resolution = 'out of date'
stage = None
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue5912'
versions = ['Python 2.4']

@abaron
Copy link
Mannequin Author

abaron mannequin commented May 3, 2009

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 bpo-1590864 for another example of this.
Following is a simple way to reproduce this behavior:

mysleep.py:
import time
time.sleep(1)

run_me_and_hang.py:
import os
import threading
import subprocess
class F(threading.Thread):
def run(self):
import mysleep
print "f is out"
f = F()
f.start()
a = subprocess.call(["echo", "DONE"])
print "exit"

@abaron abaron mannequin added the type-crash A hard crash of the interpreter, possibly with a core dump label May 3, 2009
@apevec
Copy link
Mannequin

apevec mannequin commented May 14, 2009

Issue is not reproducible with python 2.5, following patch fixes it on
python 2.4:

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

 __all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"])

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

  • from errno import ENOENT, ENOTDIR
     if env is not None:
         func = execve

@benjaminp
Copy link
Contributor

2.4 is no longer supported.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

1 participant