
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2014-03-25 04:47 bytholzer, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| fix_typo_21058.patch | vajrasky,2014-03-25 15:15 | review | ||
| Messages (7) | |||
|---|---|---|---|
| msg214778 -(view) | Author: (tholzer) | Date: 2014-03-25 04:47 | |
The NamedTemporaryFile inside the standard tempfile library leaks an open file descriptor when fdopen fails.Test case:# ulimit -SHn 50# python test1.pyfrom tempfile import NamedTemporaryFilewhile 1: try: NamedTemporaryFile(mode='x') except ValueError as ex: passOutput:Traceback (most recent call last): File "./a2.py", line 7, in <module> File "/usr/lib/python2.7/tempfile.py", line 454, in NamedTemporaryFile File "/usr/lib/python2.7/tempfile.py", line 235, in _mkstemp_innerOSError: [Errno 24] Too many open files: '/tmp/tmpI0MIEW'Error in sys.excepthook:Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/apport_python_hook.py", line 66, in apport_excepthookImportError: No module named fileutilsOriginal exception was:Traceback (most recent call last): File "./a2.py", line 7, in <module> File "/usr/lib/python2.7/tempfile.py", line 454, in NamedTemporaryFile File "/usr/lib/python2.7/tempfile.py", line 235, in _mkstemp_innerOSError: [Errno 24] Too many open files: '/tmp/tmpI0MIEW'Patch:@@ -452,7 +452,11 @@ flags |= _os.O_TEMPORARY (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)- file = _os.fdopen(fd, mode, bufsize)+ try:+ file = _os.fdopen(fd, mode, bufsize)+ except Exception as ex:+ _os.close(fd)+ raise return _TemporaryFileWrapper(file, name, delete) if _os.name != 'posix' or _os.sys.platform == 'cygwin': | |||
| msg214779 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-03-25 08:08 | |
New changesetf2f0eec4a556 by Victor Stinner in branch '2.7':Issue#21058: Fix a leak of file descriptor in tempfile.NamedTemporaryFile(),http://hg.python.org/cpython/rev/f2f0eec4a556 | |||
| msg214780 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-03-25 08:11 | |
New changeset182f08c0dd45 by Victor Stinner in branch '2.7':Issue#21058: NamedTemporaryFile() closes the FD on any error, not only Exceptionhttp://hg.python.org/cpython/rev/182f08c0dd45 | |||
| msg214783 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-03-25 08:19 | |
New changeset7f87c26f59ab by Victor Stinner in branch '3.4':Issue#21058: Fix a leak of file descriptor in tempfile.NamedTemporaryFile(),http://hg.python.org/cpython/rev/7f87c26f59abNew changesetb1e3035216f8 by Victor Stinner in branch 'default':(Merge 3.4) Issue#21058: Fix a leak of file descriptor inhttp://hg.python.org/cpython/rev/b1e3035216f8 | |||
| msg214786 -(view) | Author: STINNER Victor (vstinner)*![]() | Date: 2014-03-25 08:22 | |
Thanks for the report, the issue is now fixed. | |||
| msg214830 -(view) | Author: Vajrasky Kok (vajrasky)* | Date: 2014-03-25 15:15 | |
There is a typo.s/io.pen/io.open/ | |||
| msg214841 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2014-03-25 17:19 | |
New changesetaa2a05fe46ae by Victor Stinner in branch '3.4':Issue#21058: fix typo in a comment. Patch written by Vajrasky Kok.http://hg.python.org/cpython/rev/aa2a05fe46aeNew changeset4e3c76cb0e8a by Victor Stinner in branch 'default':(Merge 3.4) Issue#21058: fix typo in a comment. Patch written by Vajrasky Kok.http://hg.python.org/cpython/rev/4e3c76cb0e8a | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:00 | admin | set | github: 65257 |
| 2014-03-25 17:19:59 | python-dev | set | messages: +msg214841 |
| 2014-03-25 15:15:05 | vajrasky | set | files: +fix_typo_21058.patch nosy: +vajrasky messages: +msg214830 keywords: +patch |
| 2014-03-25 08:22:10 | vstinner | set | status: open -> closed nosy: +vstinner messages: +msg214786 resolution: fixed |
| 2014-03-25 08:19:53 | python-dev | set | messages: +msg214783 |
| 2014-03-25 08:11:09 | python-dev | set | messages: +msg214780 |
| 2014-03-25 08:08:38 | python-dev | set | nosy: +python-dev messages: +msg214779 |
| 2014-03-25 04:47:27 | tholzer | create | |