Skip to content

Conversation

@pablogsal
Copy link
Member

@pablogsal pablogsal commented Nov 18, 2025

The test_sampling_basic_functionality, test_sample_target_script, and
test_sample_target_module tests were failing intermittently on slow
architectures (i686/s390x) because they relied on a time-based workload
with an infinite loop (while True). On slow machines, the profiler's
sampling window would end before enough iterations executed, causing
slow_fibonacci to not appear in the profiling output.

mock.patch("sys.stdout", captured_output),
):
try:
# Sample for up to SHORT_TIMEOUT seconds, but process exits after fixed iterations
Copy link
Member

Choose a reason for hiding this comment

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

This is basically just a longer duration - if we stop sampling, then the expected function (which doesn't run in the first 5 iterations) won't show up and the test will fail.

Perhaps we can check for the first function that runs in the test? Or else sample the entire process so that we know it exits after having run the function we're checking for?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right now is sampling the entire process. The iterations are such that SHORT_TIMEOUT is effectively too long for the typical duration of that process

Copy link
Member

Choose a reason for hiding this comment

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

Okay yeah, I agree (after going through a complicated thought process involving waiting for the process to actually start, which would also require a timeout, which would also be SHORT_TIMEOUT...)

Copy link
Member Author

@pablogsal pablogsal Nov 19, 2025

Choose a reason for hiding this comment

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

Yeah good point. In any case the duration starts counting after the process has started and tell us it's ready. The profiler waits for confirmation from a special wrapper before starting to profile so the time fo the process to start shouldn't count. I still think 30 seconds is more than enough in any case as this is racy anyway. I will look if I can simplify what we check to make it a bit safer

Copy link
Member Author

Choose a reason for hiding this comment

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

I have simplified the test a lot, hopefully this does the trick

@pablogsal pablogsal added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 19, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @pablogsal for commit 0cd4097 🤖

Results will be shown at:

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

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 19, 2025
@pablogsal pablogsal added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 21, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @pablogsal for commit d9124f3 🤖

Results will be shown at:

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

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 21, 2025
…ness

The test_sampling_basic_functionality, test_sample_target_script, and
test_sample_target_module tests were failing intermittently on slow
architectures (i686/s390x) because they relied on a time-based workload
with an infinite loop (while True). On slow machines, the profiler's
sampling window would end before enough iterations executed, causing
slow_fibonacci to not appear in the profiling output.
@pablogsal pablogsal added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 21, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @pablogsal for commit 9b4a823 🤖

Results will be shown at:

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

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Nov 21, 2025
@pablogsal pablogsal merged commit 92972ae into python:main Nov 21, 2025
98 of 99 checks passed
@pablogsal pablogsal deleted the gh-140381 branch November 21, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants