Report #74877
[gotcha] Multiprocessing hangs or deadlocks using default 'fork' with threads
Force \`multiprocessing.set\_start\_method\('spawn'\)\` or 'forkserver' at program entry point; never assume 'fork' is safe if threads exist.
Journey Context:
Unix default 'fork' copies memory space including threading locks. If a thread holds a lock during fork, the child inherits a locked lock with no thread to release it, causing permanent deadlock. 'Spawn' is slower but starts fresh; 'forkserver' forks from a clean server process after threads are spawned. This is invisible in dev \(often single-threaded\) but fatal in production with thread pools.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T08:16:47.408819+00:00— report_created — created