[New-bugs-announce] [issue46367] multiprocessing's "spawn" doesn't actually use spawn

jakirkham report at bugs.python.org
Thu Jan 13 14:20:59 EST 2022

New submission from jakirkham <jakirkham at gmail.com>:

Reporting an issue recently encountered by a colleague.

It appears the `multiprocessing`'s "spawn" mode doesn't actually use POSIX spawn, but instead uses fork+exec[1]. While this is certainly a useful feature in its own right, this not quite one would expect from something described as spawn. AFAICT the documentation doesn't point this out.

This is important as some libraries are not fork-safe and even fork+exec is not sufficient to protect them. Would be helpful if "spawn" did use POSIX spawn and the current behavior was covered under a clearer name (like "forkexec").

1. https://github.com/python/cpython/blob/af6b4068859a5d0c8afd696f3c0c0155660211a4/Lib/multiprocessing/util.py#L448-L458

components: Library (Lib)
messages: 410512
nosy: jakirkham
priority: normal
severity: normal
status: open
title: multiprocessing's "spawn" doesn't actually use spawn
type: behavior
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list