Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If MAXFD too high, popen2/subprocess produce MemoryErrors #43506

Closed
pav3901 mannequin opened this issue Jun 15, 2006 · 4 comments
Closed

If MAXFD too high, popen2/subprocess produce MemoryErrors #43506

pav3901 mannequin opened this issue Jun 15, 2006 · 4 comments
Labels
stdlib Python modules in the Lib dir

Comments

@pav3901
Copy link
Mannequin

pav3901 mannequin commented Jun 15, 2006

BPO 1506758

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2006-06-22.20:32:42.000>
created_at = <Date 2006-06-15.16:06:27.000>
labels = ['library']
title = 'If MAXFD too high, popen2/subprocess produce MemoryErrors'
updated_at = <Date 2006-06-22.20:32:42.000>
user = 'https://bugs.python.org/pav3901'

bugs.python.org fields:

activity = <Date 2006-06-22.20:32:42.000>
actor = 'astrand'
assignee = 'astrand'
closed = True
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2006-06-15.16:06:27.000>
creator = 'pav3901'
dependencies = []
files = []
hgrepos = []
issue_num = 1506758
keywords = []
message_count = 4.0
messages = ['28798', '28799', '28800', '28801']
nosy_count = 2.0
nosy_names = ['astrand', 'pav3901']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue1506758'
versions = ['Python 2.4']

@pav3901
Copy link
Mannequin Author

pav3901 mannequin commented Jun 15, 2006

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().

@pav3901 pav3901 mannequin closed this as completed Jun 15, 2006
@pav3901 pav3901 mannequin assigned astrand Jun 15, 2006
@pav3901 pav3901 mannequin added the stdlib Python modules in the Lib dir label Jun 15, 2006
@pav3901
Copy link
Mannequin Author

pav3901 mannequin commented Jun 15, 2006

Logged In: YES
user_id=652852

I've submitted a patch against release24-maint for this bug:
1506760

1 similar comment
@pav3901
Copy link
Mannequin Author

pav3901 mannequin commented Jun 15, 2006

Logged In: YES
user_id=652852

I've submitted a patch against release24-maint for this bug:
1506760

@astrand
Copy link
Mannequin

astrand mannequin commented Jun 22, 2006

Logged In: YES
user_id=344921

Patch 1506760 has been applied.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

0 participants