This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Popen pipe file descriptor leak on OSError in init
Type: resource usage Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: justinfrancis, kcwu, schmir
Priority: normal Keywords:

Created on 2007-07-10 15:04 by justinfrancis, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
diff-issue1751245.txt kcwu, 2008-02-11 09:31 patch for trunk
Messages (2)
msg32471 - (view) Author: Justin Francis (justinfrancis) Date: 2007-07-10 15:04
OS: Gentoo Linux 2.6.12-r6
Python: 2.5 r25:51908

When creating a Popen object that refers to a file that does not exist, the pipes that are created are not closed, and remain in the system. In long-running processes, this will eventually use up all the file descriptors available.

>> import os, subprocess
>> os.system('/usr/sbin/lsof | grep python | grep -i pipe')
...
python    18822 jfrancis    6r     FIFO        0,5               56188 pipe
python    18822 jfrancis    7r     FIFO        0,5               56190 pipe
>> p = subprocess.Popen('doesnotexist', stdout=subprocess.PIPE)
OSError: [Errno 2] No such file or directory
>> os.system('/usr/sbin/lsof | grep python | grep -i pipe')
...
python    18822 jfrancis    6r     FIFO        0,5               56188 pipe
python    18822 jfrancis    7r     FIFO        0,5               56190 pipe
python    18822 jfrancis    8r     FIFO        0,5               56713 pipe
msg85869 - (view) Author: Kuang-che Wu (kcwu) Date: 2009-04-11 17:06
this is duplicated to issue 5179 and is fixed in trunk
History
Date User Action Args
2022-04-11 14:56:25adminsetgithub: 45162
2009-04-11 18:34:56benjamin.petersonsetstatus: open -> closed
resolution: duplicate
2009-04-11 17:06:46kcwusetnosy: + kcwu
messages: + msg85869
2008-03-10 12:40:10schmirsetnosy: + schmir
type: resource usage
2008-02-11 09:31:36kcwusetfiles: + diff-issue1751245.txt
2007-07-10 15:04:08justinfranciscreate