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: If MAXFD too high, popen2/subprocess produce MemoryErrors
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: astrand Nosy List: astrand, pav3901
Priority: normal Keywords:

Created on 2006-06-15 16:06 by pav3901, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg28798 - (view) Author: Peter Vetere (pav3901) Date: 2006-06-15 16:06
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().
msg28799 - (view) Author: Peter Vetere (pav3901) Date: 2006-06-15 16:15
Logged In: YES 
user_id=652852

I've submitted a patch against release24-maint for this bug:
 1506760
msg28800 - (view) Author: Peter Vetere (pav3901) Date: 2006-06-15 19:31
Logged In: YES 
user_id=652852

I've submitted a patch against release24-maint for this bug:
 1506760
msg28801 - (view) Author: Peter Åstrand (astrand) * (Python committer) Date: 2006-06-22 20:32
Logged In: YES 
user_id=344921

Patch 1506760 has been applied. 
History
Date User Action Args
2022-04-11 14:56:18adminsetgithub: 43506
2006-06-15 16:06:27pav3901create