[issue24909] Windows: subprocess.Popen: race condition for leaking inheritable handles

STINNER Victor report at bugs.python.org
Thu Sep 10 21:12:42 CEST 2015


STINNER Victor added the comment:

> The one potential problem that I see is that it looks like specifying PROC_THREAD_ATTRIBUTE_HANDLE_LIST means that no other handles are inherited, even if they are inheritable.

We can maybe add a parameter to configure the behaviour: keep current behaviour by default in Python 3.6 and change the default in Python 3.7 for example.

> I could add Windows support for pass_fds, (...)

Yes, we need a new "pass_handles" parameter to pass a list of handles which will be explicitly inherited. This parameter is useful even if you inherit all inheritable handles, because handles can be non-inhertable too.

It's the same with pass_fds: if you pass a file descriptor in pass_fds, it will be marked as inheritable to be passed to the child.

I guess that "pass_handles" will be implemented with PROC_THREAD_ATTRIBUTE_HANDLE_LIST, or by making handles temporary inheritable if PROC_THREAD_ATTRIBUTE_HANDLE_LIST is not available.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24909>
_______________________________________


More information about the Python-bugs-list mailing list