[docs] [issue19809] Doc: subprocess should warn uses on race conditions when multiple threads spawn child processes

Eryk Sun report at bugs.python.org
Wed Jul 24 16:56:43 EDT 2019

Eryk Sun <eryksun at gmail.com> added the comment:

> This is still the case on windows as the pipes created to talk to the
> process might be inherited by two or more simultaneous CreateProcess 
> calls.

subprocess already uses PROC_THREAD_ATTRIBUTE_HANDLE_LIST to address this problem, at least between its own subprocess.Popen calls. The handles in the list still have to be inheritable, so it does not solve the problem with os.system and os.spawn* calls that are concurrent with subprocess.Popen -- nor extension-module, ctypes, cffi, or PyWin32 code  in the wild that inherits handles without PROC_THREAD_ATTRIBUTE_HANDLE_LIST. There's a warning about this in the docs:


It's why we can't use the handle list to implement pass_fds in Windows and why the general capability is buried in STARTUPINFO, instead of being exposed as a high-level Popen parameter.

nosy: +eryksun

Python tracker <report at bugs.python.org>

More information about the docs mailing list