classification
Title: test_imp resource leak
Type: resource usage Stage: resolved
Components: Interpreter Core Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, pitrou, python-dev, skrah
Priority: high Keywords:

Created on 2012-02-22 08:37 by skrah, last changed 2012-02-22 17:13 by pitrou. This issue is now closed.

Messages (4)
msg153935 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2012-02-22 08:37
I tried to reproduce the failure from #14080 using this:

./python -m test -uall -v -F test_imp


After around 500 iterations the test fails:


======================================================================
ERROR: test_find_module_encoding (test.test_imp.ImportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/stefan/pydev/cpython/Lib/test/test_imp.py", line 58, in test_find_module_encoding
    with imp.find_module('module_' + mod, self.test_path)[0] as fd:
OSError: [Errno 24] Too many open files

======================================================================
ERROR: test_issue1267 (test.test_imp.ImportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/stefan/pydev/cpython/Lib/test/test_imp.py", line 70, in test_issue1267
    self.test_path)
OSError: [Errno 24] Too many open files

======================================================================
ERROR: test_issue3594 (test.test_imp.ImportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/stefan/pydev/cpython/Lib/test/test_imp.py", line 92, in test_issue3594
    file, filename, info = imp.find_module(temp_mod_name)
OSError: [Errno 24] Too many open files

======================================================================
ERROR: test_issue9319 (test.test_imp.ImportTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/stefan/pydev/cpython/Lib/test/test_imp.py", line 182, in test_issue9319
    imp.find_module, "badsyntax_pep3120", [path])
  File "/home/stefan/pydev/cpython/Lib/unittest/case.py", line 571, in assertRaises
    return context.handle('assertRaises', callableObj, args, kwargs)
  File "/home/stefan/pydev/cpython/Lib/unittest/case.py", line 135, in handle
    callable_obj(*args, **kwargs)
OSError: [Errno 24] Too many open files
msg153966 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-02-22 16:04
Both test_issue9319 and test_find_module_encoding seem to leak file descriptors.
msg153972 - (view) Author: Roundup Robot (python-dev) Date: 2012-02-22 17:12
New changeset cbfd2bf80db0 by Antoine Pitrou in branch '3.2':
Issue #14084: Fix a file descriptor leak when importing a module with a bad encoding.
http://hg.python.org/cpython/rev/cbfd2bf80db0

New changeset fcd0a67e708e by Antoine Pitrou in branch 'default':
Issue #14084: Fix a file descriptor leak when importing a module with a bad encoding.
http://hg.python.org/cpython/rev/fcd0a67e708e
msg153973 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-02-22 17:13
Should be fixed now.
History
Date User Action Args
2012-02-22 17:13:00pitrousetstatus: open -> closed
resolution: fixed
messages: + msg153973

stage: needs patch -> resolved
2012-02-22 17:12:04python-devsetnosy: + python-dev
messages: + msg153972
2012-02-22 16:04:11pitrousetpriority: normal -> high

stage: needs patch
messages: + msg153966
versions: + Python 3.2
2012-02-22 08:38:19skrahsettype: behavior -> resource usage
2012-02-22 08:37:47skrahcreate