[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-11-05 Thread Mark Gius
Mark Gius added the comment: My contributor form has been accepted. Anything else I should be doing to work towards getting a fix applied? -- ___ Python tracker <http://bugs.python.org/issue16

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-29 Thread Mark Gius
Mark Gius added the comment: I've also submitted the contributor form requested. -- ___ Python tracker <http://bugs.python.org/issue16327> ___ ___ Pytho

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-29 Thread Mark Gius
Mark Gius added the comment: Here's more or less the same fix and test on 2.7. I jumped through the hoop to preserve the original exception and traceback even if os.close() raises an exception. This follows the 3.3 branch's cleanup behavior of silently suppressing errors in the cl

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-29 Thread Mark Gius
Mark Gius added the comment: Patch fixes and tests fd leak on Python 3.3. Test fails without fix, passes with fix. I found an existing test looking for fd leaks for another bug. Borrowed the verification bits from it. There were some other test failures when I ran the subprocess suite on

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-28 Thread Mark Gius
Mark Gius added the comment: Doesn't exhibit when execve fails, because by the time execve has been reached we've closed the pipes that we're supposed to close on the parent process, and the pipes that are meant to remain open on the parent process get caught by existing clea

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-25 Thread Mark Gius
Mark Gius added the comment: attachment against 2.7 if I understand this code correctly, the fix shouldn't need to be fixed separately on windows and Linux, since the thing handled by init is just a file descriptor. Good idea on the testing. I'll give that a shot tomorrow. I thin

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-25 Thread Mark Gius
Mark Gius added the comment: Patch now only closes pipe fds created by Popen -- Added file: http://bugs.python.org/file27720/fd_leak_fix_v2.diff ___ Python tracker <http://bugs.python.org/issue16

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-25 Thread Mark Gius
Mark Gius added the comment: Just read the docs for stdin and stdout. This patch will indtroduce a bug where a provided file descriptor can be closed. This definitely shouldn't close a file descriptor that isn't created by _get_handles(). I

[issue16327] subprocess.Popen leaks file descriptors on os.fork() failure

2012-10-25 Thread Mark Gius
New submission from Mark Gius: When subprocess.Popen is called with subprocess.PIPE and os.fork() fails (due to insufficient memory for example), the pipes created by _get_handles() are not closed. Steps to reproduce: 1) Launch a python shell, import subprocess 2) Create a situation where