Message6561

Author mkz
Recipients mkz
Date 2011-07-03.06:00:34
SpamBayes Score 8.826273e-14
Marked as misclassified No
Message-id <1309672835.65.0.025648019176.issue1765@psf.upfronthosting.co.za>
In-reply-to
Content
Code that repeatedly calls subprocess.Popen() will crash with
'Too many files open' error.

Attached files reproduce it.  Crash is reproducable also with default
ulimit (1024).

Python code contains several patterns of Popen usage, all leaky.

Excpected: .communicate() and code that closes fds excplicitly
should be safe.

test script:
--------------------------
#! /bin/sh

# crash faster
ulimit -n 32

jython ./proctest.py

# jython leaves tty messed up
stty sane

--------------------------
Output:

$ ./test.sh
0
1
2
3
4
5
Traceback (most recent call last):
  File "./proctest.py", line 9, in <module>
    p = Popen(['true'])
  File "/opt/apps/jython/Lib/subprocess.py", line 751, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/opt/apps/jython/Lib/subprocess.py", line 1265, in _execute_child
    raise OSError(e.getMessage() or e)
OSError: Cannot run program "true" (in directory "/home/marko/src/niisama/rarfile/jxx"): java.io.IOException: error=24, Too many open files
History
Date User Action Args
2011-07-03 06:00:35mkzsetrecipients: + mkz
2011-07-03 06:00:35mkzsetmessageid: <1309672835.65.0.025648019176.issue1765@psf.upfronthosting.co.za>
2011-07-03 06:00:35mkzlinkissue1765 messages
2011-07-03 06:00:35mkzcreate