New issue 492: File descriptor leakage https://bitbucket.org/hpk42/pytest/issue/492/file-descriptor-leakage
Marc Abramowitz: I am periodically seeing failures due to file descriptor leakage in both builds on Drone.io (e.g.: https://drone.io/bitbucket.org/msabramo/pytest/6) and locally using `tox`: >From https://drone.io/bitbucket.org/msabramo/pytest/6: ``` ==================================== ERRORS ==================================== ERROR at teardown of TestStdCaptureFD.test_capturing_readouterr_decode_error_handling item = <Function 'test_capturing_readouterr_decode_error_handling'> __multicall__ = <MultiCall 0 results, 0 meths, kwargs={'nextitem': <Function 'test_reset_twice_error'>, 'item': <Function 'test_capturing_readouterr_decode_error_handling'>}> def pytest_runtest_teardown(item, __multicall__): item.config._basedir.chdir() if hasattr(item.config, '_numfiles'): x = __multicall__.execute() > check_open_files(item.config) conftest.py:50: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ config = <_pytest.config.Config object at 0x7f9230096290> def check_open_files(config): out2 = py.process.cmdexec("lsof -p %d" % pid) lines2 = getopenfiles(out2) if len(lines2) > config._numfiles + 3: error = [] error.append("***** %s FD leackage detected" % (len(lines2)-config._numfiles)) error.extend(lines2) error.append(error[0]) # update numfile so that the overall test run continuess config._numfiles = len(lines2) > raise AssertionError("\n".join(error)) E AssertionError: ***** 4 FD leackage detected E py.test 1283 ubuntu 0r CHR 1,3 0t0 1445164 /dev/null E py.test 1283 ubuntu 8r REG 253,0 3 3929 /tmp/pytest-0/testdir/test_writeorg0/test_writeorg.py E py.test 1283 ubuntu 9r CHR 1,3 0t0 1445164 /dev/null E py.test 1283 ubuntu 11r CHR 1,3 0t0 1445164 /dev/null E ***** 4 FD leackage detected conftest.py:44: AssertionError ``` >From a local `tox` run: ``` ==================================================================================== ERRORS ==================================================================================== _______________________________________________________ ERROR at teardown of TestStdCaptureFD.test_capturing_done_simple _______________________________________________________ item = <Function 'test_capturing_done_simple'> __multicall__ = <MultiCall 0 results, 0 meths, kwargs={'item': <Function 'test_capturing_done_simple'>, 'nextitem': <Function 'test_capturing_reset_simple'>}> def pytest_runtest_teardown(item, __multicall__): item.config._basedir.chdir() if hasattr(item.config, '_numfiles'): x = __multicall__.execute() > check_open_files(item.config) conftest.py:50: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ config = <_pytest.config.Config object at 0x1013c4350> def check_open_files(config): out2 = py.process.cmdexec("lsof -p %d" % pid) lines2 = getopenfiles(out2) if len(lines2) > config._numfiles + 3: error = [] error.append("***** %s FD leackage detected" % (len(lines2)-config._numfiles)) error.extend(lines2) error.append(error[0]) # update numfile so that the overall test run continuess config._numfiles = len(lines2) > raise AssertionError("\n".join(error)) E AssertionError: ***** 4 FD leackage detected E python3.3 99001 marca 0r CHR 3,2 0t0 305 /dev/null E python3.3 99001 marca 1u REG 1,2 0 29288704 /private/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/tmpn1zy1r E python3.3 99001 marca 2u REG 1,2 0 29288705 /private/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/tmp1ho8lz E python3.3 99001 marca 3w REG 1,2 3681 29266158 /Users/marca/dev/hg-repos/pytest/.tox/py26/log/py26-0.log E python3.3 99001 marca 6w REG 1,2 3819 29276170 /Users/marca/dev/hg-repos/pytest/.tox/py27/log/py27-0.log E python3.3 99001 marca 7w REG 1,2 3841 29286174 /Users/marca/dev/hg-repos/pytest/.tox/py33/log/py33-0.log E python3.3 99001 marca 8u CHR 16,3 0t11092970 811 /dev/ttys003 E python3.3 99001 marca 9u REG 1,2 0 29288704 /private/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/tmpn1zy1r E python3.3 99001 marca 10u REG 1,2 0 29288705 /private/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/tmp1ho8lz E python3.3 99001 marca 11u CHR 16,3 0t11092970 811 /dev/ttys003 E python3.3 99001 marca 12u CHR 16,3 0t11092970 811 /dev/ttys003 E python3.3 99001 marca 13u REG 1,2 3 29290273 /private/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/pytest-205/testdir/test_writeorg0/test_writeorg.py E python3.3 99001 marca 14r CHR 3,2 0t0 305 /dev/null E python3.3 99001 marca 15u REG 1,2 0 29288704 /private/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/tmpn1zy1r E python3.3 99001 marca 17u REG 1,2 0 29288705 /private/var/folders/gw/w0clrs515zx9x_55zgtpv4mm0000gp/T/tmp1ho8lz E ***** 4 FD leackage detected conftest.py:44: AssertionError ``` _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit