-
-
Notifications
You must be signed in to change notification settings - Fork 228
Open
Description
On macOS, the following program crashes with our builds, but works as expected with /usr/bin/python3:
import os
import tkinter
if os.fork() == 0:
os.fork()
print("hi")
The child dies with this backtrace:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib 0x192243afc _os_unfair_lock_corruption_abort + 88
1 libsystem_platform.dylib 0x19223e3c0 _os_unfair_lock_lock_slow + 332
2 libtcl8.6.dylib 0x10326c7f8 AtForkPrepare + 44
3 libsystem_pthread.dylib 0x19220630c _pthread_atfork_prepare_handlers + 92
4 libSystem.B.dylib 0x1a044a178 libSystem_atfork_prepare + 32
5 libsystem_c.dylib 0x1920ba3a4 fork + 36
6 libpython3.13.dylib 0x104773e1c os_fork_impl + 120
7 libpython3.13.dylib 0x1041d91d8 cfunction_vectorcall_NOARGS.llvm.16321590194594904093 + 100
8 libpython3.13.dylib 0x103f47b40 _PyEval_EvalFrameDefault + 40532
and this app-specific information in the crash log:
{
"CoreFoundation":["*** single-threaded process forked ***"],
"libsystem_platform.dylib":["BUG IN CLIENT OF LIBPLATFOR
M: os_unfair_lock is corrupt","Abort Cause 258"],
"libsystem_c.dylib":["crashed on child side of fork pre-exec"]
}
Deferring the tkinter import until after forking fixes it.
I feel like I saw this in one of the other threads I was staring at, probably in another project? intentionally avoiding importing tkinter as far as possible? And see also python/cpython#77292. I'd be tempted to say this isn't our fault except clearly it works fine on system Python.
reteps
Metadata
Metadata
Assignees
Labels
No labels