-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
Python <=3.9 segmentation fault in code snippet #117090
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
Comments
Segfault is sometimes security issue, not always, but the more important thing is - can you repro this without |
I'm unable to spend more cycles on this but I'll create an OpenTelemetry issue. If that results in something useful, I'll re-open. |
I can reproduce it without otel. ref import os, time
f = open("foo.txt", "w")
class C:
def __init__(self):
self.f = f
os.register_at_fork(after_in_child=self.atfork)
def atfork(self):
print("atfork")
c=C()
del c, f This issue caused by this code is called during late interpreter shutdown. Line 916 in 1f8b24e
This issue is fixed by this commit in Python 3.10. But I am not sure about similar SEGV is not possible anymore. |
I checked finalization code and I can not find any way to emit ResourceWarning after |
Bug report
Bug description:
The following code snippet results in a segmentation fault in Python 3.8 and 3.9, but not 3.10 and newer:
The following conditions need to be met for the segmentation fault to happen:
fd
must not be closed (does not happen iffd.close()
is run at the end)I could reproduce this segfault on both macOS Sonoma 14.3.1 and Ubuntu Linux 23.10.
I realize that 3.8 and 3.9 are no longer in the "bugfix" phase but the segfault may have security implications, which is why I decided to open this issue. Please feel free to close if it's not helpful.
CPython versions tested on:
3.8, 3.9, 3.10, 3.13
Operating systems tested on:
Linux, macOS
The text was updated successfully, but these errors were encountered: