Skip to content

Conversation

@lesteve
Copy link
Contributor

@lestevelesteve commented Sep 13, 2024

Fix#122957.

Locally I tested this by running the test 1000 times with the command and the diff below. It fails around 10-20 times out of 1000 on main and does not fail out of 1000 times with the fix on this PR.

./python -m test.test_asyncio.test_threads -k concurrent -v 
diff --git a/Lib/test/test_asyncio/test_threads.py b/Lib/test/test_asyncio/test_threads.py index 774380270a7..8504544aaba 100644 --- a/Lib/test/test_asyncio/test_threads.py+++ b/Lib/test/test_asyncio/test_threads.py@@ -63,4 +63,10 @@ def get_ctx(): if __name__ == "__main__": - unittest.main()+ nb_tests = 1000+ suite = unittest.TestSuite(+ [ToThreadTests("test_to_thread_concurrent") for _ in range(nb_tests)]+ )++ test_runner = unittest.TextTestRunner()+ test_runner.run(suite)

@ghost
Copy link

ghost commented Sep 13, 2024

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@JelleZijlstra
Copy link
Member

Should we backport this to 3.12 and 3.13?

@colesbury
Copy link
Contributor

I think we've only ever seen the flakiness on the free-threaded build, so a backport to 3.12 is probably not necessary, although I think this is a pretty low risk change.

A backport to 3.13 would be good. Otherwise, we'll probably see flaky test failures in the free-threading buildbots. It's not urgent though, and can wait until after the final release if that's more convenient.

@colesburycolesbury added the needs backport to 3.13 bugs and security fixes label Sep 13, 2024
@JelleZijlstra
Copy link
Member

OK, let's merge this and it'll be up to Thomas whether to merge the 3.13 backport, or we can just do it after 3.13.0 goes out.

@JelleZijlstraJelleZijlstra merged commit eadb966 into python:mainSep 13, 2024
@miss-islington-app
Copy link

Thanks @lesteve for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 13, 2024
@bedevere-app
Copy link

GH-124067 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13 bugs and security fixes label Sep 13, 2024
@lestevelesteve deleted the fix-free-threaded-asyncio-test-threads branch September 13, 2024 19:11
Yhg1s pushed a commit that referenced this pull request Sep 23, 2024
…uild (GH-124039) (#124067) gh-122957: Fix test flakiness in asyncio test in free-thread build (GH-124039) (cherry picked from commit eadb966) Co-authored-by: Loïc Estève <[email protected]>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dirtopic-free-threading

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_asynciotest_to_thread_concurrent flaky

3 participants

@lesteve@JelleZijlstra@colesbury