Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix slowdown in tests waiting for server to close #8609

Closed
wants to merge 2 commits into from
Closed

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Aug 5, 2024

What do these changes do?

There were a few tests that had to wait 60s to teardown because we would wait for the server to close in places we were not testing the server close logic. This added a few minutes to the test runs (18 minutes vs 5 minutes). Set the timeout to the monotonic clock resolution to reduce test time.

Are there changes in behavior for the user?

no

Is it a substantial burden for the maintainers to support this?

no

@bdraco bdraco added backport-3.10 Trigger automatic backporting to the 3.10 release branch by Patchback robot backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot labels Aug 5, 2024
Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.70%. Comparing base (b7121e5) to head (798bd25).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #8609   +/-   ##
=======================================
  Coverage   97.70%   97.70%           
=======================================
  Files         107      107           
  Lines       33438    33440    +2     
  Branches     3927     3927           
=======================================
+ Hits        32672    32674    +2     
  Misses        555      555           
  Partials      211      211           
Flag Coverage Δ
CI-GHA 97.61% <100.00%> (+<0.01%) ⬆️
OS-Linux 97.27% <100.00%> (+<0.01%) ⬆️
OS-Windows 95.64% <100.00%> (+<0.01%) ⬆️
OS-macOS 96.94% <100.00%> (+<0.01%) ⬆️
Py-3.10.11 97.08% <100.00%> (-0.01%) ⬇️
Py-3.10.14 97.02% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 97.25% <100.00%> (+<0.01%) ⬆️
Py-3.12.4 97.38% <100.00%> (+<0.01%) ⬆️
Py-3.8.10 95.40% <100.00%> (+<0.01%) ⬆️
Py-3.8.18 96.91% <100.00%> (+<0.01%) ⬆️
Py-3.9.13 97.07% <100.00%> (+<0.01%) ⬆️
Py-3.9.19 97.02% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.16 96.59% <100.00%> (-0.01%) ⬇️
VM-macos 96.94% <100.00%> (+<0.01%) ⬆️
VM-ubuntu 97.27% <100.00%> (+<0.01%) ⬆️
VM-windows 95.64% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bdraco bdraco added the bot:chronographer:skip This PR does not need to include a change note label Aug 5, 2024
@bdraco bdraco marked this pull request as ready for review August 5, 2024 13:31
@bdraco bdraco requested a review from asvetlov as a code owner August 5, 2024 13:31
@Dreamsorcerer
Copy link
Member

Dreamsorcerer commented Aug 5, 2024

I thought the handler_cancellation=True stopped our tests from hanging. I also thought the only tests that take about 60s were the autobahn tests, which have never worked as they were not finished off. Maybe I missed another regression in my recent changes though..

@bdraco
Copy link
Member Author

bdraco commented Aug 5, 2024

I thought the handler_cancellation=True stopped our tests from hanging. I also thought the only tests that take about 60s were the autobahn tests, which have never worked as they were not finished off. Maybe I missed another regression in my recent changes though..

I only noticed this because test_client_ws_functional was hanging on quite a few tests.

On master

% python3 -m pytest -vvvs tests/test_client_ws_functional.py::test_close_timeout_deprecated
================================================================================ test session starts =================================================================================
platform darwin -- Python 3.12.2, pytest-8.1.1, pluggy-1.4.0 -- /Users/bdraco/aiohttp/venv/bin/python3
cachedir: .pytest_cache
rootdir: /Users/bdraco/aiohttp
configfile: setup.cfg
plugins: cov-5.0.0, mock-3.14.0, xdist-3.6.1
collected 1 item                                                                                                                                                                     

tests/test_client_ws_functional.py::test_close_timeout_deprecated[pyloop] PASSED

...hang for 60s...
============================================================================ 1 passed in 61.67s (0:01:01) ============================================================================

This branch
================================================================================= 1 passed in 1.51s ==================================================================================

@Dreamsorcerer
Copy link
Member

It was a regression in #8495, let me see if anything obvious stands out. I expected this change to only wait on less things, so unclear why it'd get slower.

@Dreamsorcerer
Copy link
Member

#8611

@Dreamsorcerer Dreamsorcerer deleted the test_slowdown branch August 5, 2024 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-3.10 Trigger automatic backporting to the 3.10 release branch by Patchback robot backport-3.11 Trigger automatic backporting to the 3.11 release branch by Patchback robot bot:chronographer:skip This PR does not need to include a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants