Ran tests and got `RuntimeError: Event loop is closed`
Describe the bug
While building aiohttp on NixOS, the test suite failed on the following tests:
XFAIL test_client_functional.py::test_broken_connection[pyloop]
XFAIL test_client_request.py::test_default_loop[pyloop]
No idea why ClientRequest() is constructed out of loop but it calls `asyncio.get_event_loop()`
XFAIL test_connector.py::test_del_with_scheduled_cleanup[pyloop]
XFAIL test_streams.py::TestStreamReader::test_ctor_global_loop
No idea why ClientRequest() is constructed out of loop but it calls `asyncio.get_event_loop()`
XFAIL test_web_app.py::test_set_loop_default_loop
No idea why _set_loop() is constructed out of loop but it calls `asyncio.get_event_loop()`
XFAIL test_web_functional.py::test_http10_keep_alive_default[pyloop]
XFAIL test_web_server.py::test_unsupported_upgrade[pyloop]
The behavior of C-extensions differs from pure-Python: https://github.com/aio-libs/aiohttp/issues/6446
XFAIL test_web_urldispatcher.py::test_decoded_url_match[pyloop-urldecoded_route]
Regression in v3.7: https://github.com/aio-libs/aiohttp/issues/5621
XFAIL test_web_urldispatcher.py::test_decoded_url_match[pyloop-urldecoded_route_with_regex]
Regression in v3.7: https://github.com/aio-libs/aiohttp/issues/5621
XFAIL test_web_urldispatcher.py::test_decoded_url_match[pyloop-urlencoded_route]
Regression in v3.7: https://github.com/aio-libs/aiohttp/issues/5621
ERROR test_web_sendfile_functional.py::test_static_file_if_modified_since_past_date[sendfile-pyloop]
ERROR test_web_sendfile_functional.py::test_static_file_if_match[sendfile-pyloop-Fri, 31 Dec 0000 23:59:59 GMT]
ERROR test_web_sendfile_functional.py::test_static_file_if_match[no_sendfile-pyloop-]
ERROR test_web_sendfile_functional.py::test_static_file_if_match[no_sendfile-pyloop-Fri, 31 Dec 0000 23:59:59 GMT]
ERROR test_web_sendfile_functional.py::test_static_file_if_match_custom_tags[sendfile-pyloop-etags0-200-]
ERROR test_web_sendfile_functional.py::test_static_file_if_none_match[sendfile-pyloop-additional_etags0-Fri, 31 Dec 9999 23:59:59 GMT]
ERROR test_web_sendfile_functional.py::test_static_file_if_none_match[sendfile-pyloop-additional_etags1-Fri, 31 Dec 9999 23:59:59 GMT]
ERROR test_web_sendfile_functional.py::test_static_file_if_none_match[no_sendfile-pyloop-additional_etags0-]
ERROR test_web_sendfile_functional.py::test_static_file_if_none_match[no_sendfile-pyloop-additional_etags1-Fri, 31 Dec 9999 23:59:59 GMT]
ERROR test_web_sendfile_functional.py::test_static_file_if_none_match_star[sendfile-pyloop]
Full log attached.
To Reproduce
Run aiohttp tests (while the machine is under very high load?).
Expected behavior
I expected tests to pass.
Logs/tracebacks
See the full log above.
Python Version
$ python --version
Python 3.10.8
aiohttp Version
$ python -m pip show aiohttp
3.4.3
multidict Version
$ python -m pip show multidict
6.0.2
yarl Version
$ python -m pip show yarl
1.7.2
OS
NixOS 22.11
Related component
Client
Additional context
No response
Code of Conduct
- [X] I agree to follow the aio-libs Code of Conduct
I have a similar report, from Guix System:
=========================== short test summary info ============================
FAILED tests/test_circular_imports.py::test_no_warnings[aiohttp._websocket]
FAILED tests/test_circular_imports.py::test_no_warnings[aiohttp._helpers] - s...
FAILED tests/test_circular_imports.py::test_no_warnings[aiohttp._http_writer]
FAILED tests/test_circular_imports.py::test_no_warnings[aiohttp._http_parser]
FAILED tests/test_client_request.py::test_default_loop[pyloop] - DeprecationW...
FAILED tests/test_streams.py::TestStreamReader::test_ctor_global_loop - Depre...
FAILED tests/test_web_app.py::test_set_loop_default_loop - DeprecationWarning...
ERROR tests/test_web_sendfile_functional.py::test_static_file_if_none_match[sendfile-pyloop-additional_etags1-]
ERROR tests/test_web_sendfile_functional.py::test_static_file_if_match[no_sendfile-pyloop-]
ERROR tests/test_web_sendfile_functional.py::test_static_file_if_none_match[no_sendfile-pyloop-additional_etags1-]
ERROR tests/test_web_urldispatcher.py::test_decoded_url_match[pyloop-urldecoded_route]
====== 7 failed, 2517 passed, 20 skipped, 22 xfailed, 4 errors in 46.58s =======
Python is at 3.10.7 and the direct dependencies are:
[email protected] [email protected] [email protected] [email protected]
+ [email protected] [email protected] [email protected] [email protected]
+ [email protected] [email protected] [email protected] [email protected]
+ [email protected] [email protected] [email protected] [email protected]
+ [email protected] [email protected]
I'm attaching the log in case it's useful. python-aiohttp-3.8.4.drv.txt
The tests were removed from master: https://github.com/aio-libs/aiohttp/pull/3580/files#diff-63e1318022aca08ddc776e263358f972730e2d73fc8da516783b1c5445f30114
They've probably been kept in 3.x for backwards compatibility, but the behaviour's getting old enough now that we should maybe consider backporting that PR..
Nevermind, that's the xfail tests, not the ones erroring.
The errors are all caused by GeneratorExit. I don't see how this could relate to us. Is this still reproducible on the latest release with latest pytest and pytest-asyncio?
Hm, I tried testing this with GNU Guix and got stuck in Python dependency hell upgrades; it'll have to wait, sorry.
I confirm these no longer fail, thanks.