[ python-Bugs-1506758 ] If MAXFD too high, popen2/subprocess produce MemoryErrors

SourceForge.net noreply at sourceforge.net
Thu Jun 15 18:06:28 CEST 2006


Bugs item #1506758, was opened at 2006-06-15 16:06
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1506758&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Peter Vetere (pav3901)
Assigned to: Nobody/Anonymous (nobody)
Summary: If MAXFD too high, popen2/subprocess produce MemoryErrors

Initial Comment:
Both the subprocess and the popen2 modules use the
range(...) function to iterate over and close inherited
file descriptors when a subprocess is spawned.  In the
OS environment, it possible (using ulimit -n) to set
SC_OPEN_MAX (and thus MAXFD in these modules) to a very
high value.  This can exhaust the limitations of the
range() function, producing a MemoryError.  The better
thing to do would be to use xrange() instead.

In particular, this bug occurs in
subprocess._close_fds()  and popen2._run_child().


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1506758&group_id=5470


More information about the Python-bugs-list mailing list