You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Free-threaded CPython with PYTHON_GIL=0: first calls from several threads at once crash the process #68
This work was produced with the help of language models.
On free-threaded CPython with the GIL disabled (PYTHON_GIL=0 or -Xgil=0), several threads making their first driver calls at the same time crash the process intermittently: SIGSEGV, free(): invalid pointer or malloc(): corrupted top size. The driver fills its import cache (the Python objects it loads on first use: datetime, uuid, pandas, ...) lazily with no synchronization and relies on the GIL, so concurrent first loads race on a shared vector. Making one driver call from a single thread before starting the others avoids it.
The module does not declare free-threading support, so by default importing it re-enables the GIL (with a RuntimeWarning) and nothing crashes; the crash needs the GIL disabled explicitly.
Activity