[issue34663] Support POSIX_SPAWN_USEVFORK flag in posix_spawn

Ronald Oussoren report at bugs.python.org
Tue Sep 18 15:57:24 EDT 2018


Ronald Oussoren <ronaldoussoren at mac.com> added the comment:

I did some more research:

* <https://sourceware.org/bugzilla/show_bug.cgi?id=10354> seems to indicate that glibc switched to a different implementation of posix_spawn that uses clone(2) instead of fork()/vfork() to avoid some problems with vfork(). 

The start of the issue also contains some information on why glibc is (was?) so conservative about using vfork, and a possible work around (disable cancelation points around the call to posix_spawn).

* <https://github.com/lattera/glibc/blob/master/sysdeps/unix/sysv/linux/spawni.c> is the source for the guts of posix_spawn for some version of glibc, and that indeed does use clone(...|CLONE_VFORK...) unconditionally and does not appear to test for POSIX_SPAWN_USEVFORK. 



It looks like the advise to use POSIX_SPAWN_USEVFORK is outdated, although I'm not 100% sure of my conclusion.  A glibc expert should be able to confirm or refute this. 

@pablogsal: do you have more information on why you want to enable this flag? Do you have measurements that show that adding this flag helps?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34663>
_______________________________________


More information about the Python-bugs-list mailing list