pytest-forked icon indicating copy to clipboard operation
pytest-forked copied to clipboard

Mac: Bad file descriptor

Open Dreamsorcerer opened this issue 2 years ago • 3 comments

Not sure why this has suddenly changed, but tests are now erroring on Mac OSX runners. Worst part is that the process doesn't end after this error, so the CI doesn't fail until it timeouts after 15 minutes.

See test results here (I've also verified on a separate PR, so it's not related to the coverage version bump): https://github.com/aio-libs/aiohttp-devtools/actions/runs/3783707241/jobs/6439936092

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/_pytest/main.py", line 348, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pytest_forked/__init__.py", line 51, in pytest_runtest_protocol
INTERNALERROR>     reports = forked_run_report(item)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/pytest_forked/__init__.py", line 73, in forked_run_report
INTERNALERROR>     ff = py.process.ForkedFunc(runforked)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/py/_process/forkedfunc.py", line 50, in __init__
INTERNALERROR>     self._child(nice_level, child_on_start, child_on_exit)
INTERNALERROR>   File "/Users/runner/hostedtoolcache/Python/3.10.9/x64/lib/python3.10/site-packages/py/_process/forkedfunc.py", line 74, in _child
INTERNALERROR>     stdout.close()
INTERNALERROR> OSError: [Errno 9] Bad file descriptor

Dreamsorcerer avatar Dec 27 '22 13:12 Dreamsorcerer

Bizarrely, in some cases the tests pass without this error: https://github.com/aio-libs/aiohttp-devtools/actions/runs/3825358870/jobs/6508384673 But, rerunning the failed tests continues to produce the same error result. i.e. In that test run, the 3.8 and 3.10 tests seem to keep failing. But, some have already passed, and another PR has just passed on all checks... Not sure what's going on here.

Dreamsorcerer avatar Jan 02 '23 22:01 Dreamsorcerer

Taking note that the error comes from py, maybe it's worth replacing that library, as it's not being developed anymore.

Dreamsorcerer avatar Jan 02 '23 22:01 Dreamsorcerer

@Dreamsorcerer that library is where pytest started (which is why there's still a py.test alias for it).

webknjaz avatar Jan 02 '23 22:01 webknjaz