[issue3392] subprocess fails in select when descriptors are large

STINNER Victor report at bugs.python.org
Mon Sep 22 18:34:05 CEST 2008


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

I don't understand the problem. If you open a lot of files, the open() 
loop will stop an exception (IOError: too many open files), and so 
subprocess is not used.

If I open <limit>-1 files, subprocess._get_handles() will fail on 
os.pipe().

If I open <limit>-4 files, the script doesn't fail.

I'm using Linux. Here is my script:
---
# open <limit>-4 files
import subprocess
files = []
while 1:
    try:
        newfile = open("/etc/passwd")
    except IOError, err:
        print "ERR: %s" % err
        break
    files.append(newfile)

# use -3 to get an error
for file in files[-4:]:
    print "close"
    file.close()

# success
subprocess.Popen(["date"], stdout=subprocess.PIPE).communicate()
---

----------
nosy: +haypo

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


More information about the Python-bugs-list mailing list