Skip to content

gh-129441: Fix some flakiness in test_instrumentation - #141881

Merged
colesbury merged 1 commit into
python:mainfrom
colesbury:gh-129441-test_instrumentation
Nov 24, 2025
Merged

gh-129441: Fix some flakiness in test_instrumentation#141881
colesbury merged 1 commit into
python:mainfrom
colesbury:gh-129441-test_instrumentation

Conversation

@colesbury

@colesburycolesbury commented Nov 23, 2025

Copy link
Copy Markdown
Contributor

Most of the self.assertTrue(self.called) checks are flaky because the worker threads may sometimes finish before the main thread calls self.during_threads().

Most of the `self.assertTrue(self.called)` checks are flaky because
the worker threads may sometimes finish before the main thread calls
`self.during_threads()`.
@colesburycolesbury added tests Tests in the Lib/test dir needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Nov 23, 2025
@colesburycolesbury added skip news 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section labels Nov 23, 2025
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @colesbury for commit dffc16c 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F141881%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-refleak-buildbots label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-refleak-buildbots Test PR w/ refleak buildbots; report in status section label Nov 23, 2025
@colesbury
colesbury marked this pull request as ready for review November 23, 2025 18:20

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Replacing time.sleep(0.1) with Barrier is a nice fix: sleep() is not a reliable synchronization method. With Barrier, self.called becomes redundant and so can be removed.

@vstinner

Copy link
Copy Markdown
Member

buildbot/AMD64 Windows11 Refleaks PR

Unrelated failure:

ERROR: test_sample_target_module (test.test_profiling.test_sampling_profiler.test_integration.TestSampleProfilerIntegration.test_sample_target_module)

@colesbury
colesbury merged commit 71126ab into python:mainNov 24, 2025
72 of 73 checks passed
@colesbury
colesbury deleted the gh-129441-test_instrumentation branch November 24, 2025 16:19
@miss-islington-app

Copy link
Copy Markdown

Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 24, 2025
…-141881)
Most of the `self.assertTrue(self.called)` checks are flaky because
the worker threads may sometimes finish before the main thread calls
`self.during_threads()`.
(cherry picked from commit 71126ab)
Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app

Copy link
Copy Markdown

GH-141913 is a backport of this pull request to the 3.14 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.14 bugs and security fixes label Nov 24, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 24, 2025
…-141881)
Most of the `self.assertTrue(self.called)` checks are flaky because
the worker threads may sometimes finish before the main thread calls
`self.during_threads()`.
(cherry picked from commit 71126ab)
Co-authored-by: Sam Gross <colesbury@gmail.com>
@bedevere-app

Copy link
Copy Markdown

GH-141914 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 Nov 24, 2025
colesbury added a commit that referenced this pull request Nov 24, 2025
…) (gh-141913)
Most of the `self.assertTrue(self.called)` checks are flaky because
the worker threads may sometimes finish before the main thread calls
`self.during_threads()`.
(cherry picked from commit 71126ab)
Co-authored-by: Sam Gross <colesbury@gmail.com>
colesbury added a commit that referenced this pull request Nov 24, 2025
…) (gh-141914)
Most of the `self.assertTrue(self.called)` checks are flaky because
the worker threads may sometimes finish before the main thread calls
`self.during_threads()`.
(cherry picked from commit 71126ab)
Co-authored-by: Sam Gross <colesbury@gmail.com>
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
…-141881)
Most of the `self.assertTrue(self.called)` checks are flaky because
the worker threads may sometimes finish before the main thread calls
`self.during_threads()`.
ashm-dev pushed a commit to ashm-dev/cpython that referenced this pull request Dec 8, 2025
…-141881)
Most of the `self.assertTrue(self.called)` checks are flaky because
the worker threads may sometimes finish before the main thread calls
`self.during_threads()`.
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.

4 participants

@colesbury@bedevere-bot@vstinner@kumaraditya303