[issue8052] subprocess close_fds behavior should only close open fds

Gregory P. Smith report at bugs.python.org
Tue Jan 4 03:39:03 CET 2011


Gregory P. Smith <greg at krypto.org> added the comment:

its still a problem, even the C path has to call close() a million times in that case.  thats a huge number of wasted syscalls.  fixing this is blocking on a good way to get the list of open fds.

I have seen other subprocess code do it using the race condition method of having the parent process get the list from os.listdir('/prod/self/fds') but that isn't guaranteed to get everything due to the race and we I don't believe we have enough posix async signal safe syscalls to do that in between the fork+exec.

I heard talk of actual system calls to do this type of thing (getting a list of a processes open fds) being added to future Linux kernels but I have not followed up on that to see if any have or if they are what we need.

----------

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


More information about the Python-bugs-list mailing list