-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
test_async_timeout makes multiprocessing tests with threads slow #111284
Labels
3.11
only security fixes
3.12
bugs and security fixes
3.13
bugs and security fixes
tests
Tests in the Lib/test dir
topic-multiprocessing
Comments
serhiy-storchaka
added
tests
Tests in the Lib/test dir
3.11
only security fixes
3.12
bugs and security fixes
topic-multiprocessing
3.13
bugs and security fixes
labels
Oct 24, 2023
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Oct 24, 2023
serhiy-storchaka
added a commit
that referenced
this issue
Oct 30, 2023
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Oct 30, 2023
…ore reliable (pythonGH-111285) (cherry picked from commit 624ace5) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Oct 30, 2023
…ore reliable (pythonGH-111285) (cherry picked from commit 624ace5) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka
added a commit
that referenced
this issue
Oct 30, 2023
serhiy-storchaka
added a commit
that referenced
this issue
Oct 30, 2023
FullteaR
pushed a commit
to FullteaR/cpython
that referenced
this issue
Nov 3, 2023
aisk
pushed a commit
to aisk/cpython
that referenced
this issue
Feb 11, 2024
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this issue
Sep 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
3.11
only security fixes
3.12
bugs and security fixes
3.13
bugs and security fixes
tests
Tests in the Lib/test dir
topic-multiprocessing
I noticed an interesting effect. When run all tests in
test.test_multiprocessing_spawn.test_threads
, progress lingers (on 30 almost seconds) ontest_terminate
. But when run onlytest_terminate
, it completes quickly. Further research revealed that it is only slow aftertest_async_timeout
. If runtest_async_timeout
only, it completes quickly, but then Python freezes on 30 seconds (intearDownClass
).It is because
test_async_timeout
runs a long task in a thread, and then eithertest_terminate
ortearDownClass
need to wait until it is finished. This slow task can also affect all other tests, because it monopolizes one worker.The solution is to use a new pool for
test_async_timeout
and terminate it immediately after testing. It does not help for threads, but in that case we can unblock the slow task using Event.There is other issue with
test_terminate
: it terminates the pool that is global for the class, so no other tests that uses the pool can be run after it. It only worked becausetest_terminate
was at the end of sorted methods list. The solution is to use new pool intest_terminate
.It saves 1.5 minutes and makes tests more robust.
Linked PRs
The text was updated successfully, but these errors were encountered: