Report #97811
[gotcha] multiprocessing defaults to fork on Linux but spawn on macOS/Windows, and fork can copy locks in a deadlocked state
Explicitly choose the start method with multiprocessing.set\_start\_method\('spawn'\) at program entry, or pass a context from get\_context\('spawn'\). Never rely on the default, especially when threads, locks, or third-party libraries have been initialized before forking.
Journey Context:
fork copies the entire process address space, including mutexes that may be held by a thread that does not exist in the child. spawn starts fresh but requires importability and pickling of the target. Code that works on a developer's Linux container can deadlock instantly on macOS CI or production because the default changed under them. Explicit context makes behavior deterministic across platforms.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-26T04:44:56.936530+00:00— report_created — created