Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-150387: Fix hang in test_run_failed_script_live on slow buildbots - #150405

Merged
pablogsal merged 1 commit into
python:mainfrom
pablogsal:fix-gh-150387-test-run-failed-script-live-hang
May 25, 2026
Merged

gh-150387: Fix hang in test_run_failed_script_live on slow buildbots#150405
pablogsal merged 1 commit into
python:mainfrom
pablogsal:fix-gh-150387-test-run-failed-script-live-hang

Conversation

@pablogsal

@pablogsal pablogsal commented May 25, 2026

Copy link
Copy Markdown
Member

The test relied on the failing script (1/0) crashing fast enough that fewer than MIN_SAMPLES_FOR_TUI (200) samples were collected, which would trigger the early-return path in sample.sample_live and bypass the TUI input loop. On slow buildbots (ASan, TraceRefs, NoGIL) the interpreter takes long enough to bootstrap and reach the 1/0 that the profiler easily collects >=200 samples, pushing execution into the while collector.running: loop. Because the mock only queued a final q keystroke when n_times >= 500 (and the failed-script test used n_times=200), nothing ever set running to False and the test hung until the regrtest timeout.

Always queue the final q so the live TUI loop exits regardless of how many samples were collected.

โ€ฆdbots

The test relied on the failing script (``1/0``) crashing fast enough that
fewer than ``MIN_SAMPLES_FOR_TUI`` (200) samples were collected, which would
trigger the early-return path in ``sample.sample_live`` and bypass the TUI
input loop. On slow buildbots (ASan, TraceRefs, NoGIL) the interpreter
takes long enough to bootstrap and reach the ``1/0`` that the profiler
easily collects >=200 samples, pushing execution into the
``while collector.running:`` loop. Because the mock only queued a final
``q`` keystroke when ``n_times >= 500`` (and the failed-script test used
``n_times=200``), nothing ever set ``running`` to ``False`` and the test
hung until the regrtest timeout.

Always queue the final ``q`` so the live TUI loop exits regardless of how
many samples were collected.
@bedevere-app bedevere-app Bot added tests Tests in the Lib/test dir awaiting core review labels May 25, 2026
@pablogsal pablogsal added needs backport to 3.15 pre-release feature fixes, bugs and security fixes ๐Ÿ”จ test-with-buildbots Test PR w/ buildbots; report in status section labels May 25, 2026
@bedevere-bot

Copy link
Copy Markdown

๐Ÿค– New build scheduled with the buildbot fleet by @pablogsal for commit 0f17e0b ๐Ÿค–

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F150405%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 May 25, 2026
@pablogsal

Copy link
Copy Markdown
Member Author

Buildbots are happy, landing

@pablogsal
pablogsal merged commit 3cf6ef4 into python:main May 25, 2026
117 of 119 checks passed
@pablogsal
pablogsal deleted the fix-gh-150387-test-run-failed-script-live-hang branch May 25, 2026 18:17
@miss-islington-app

Copy link
Copy Markdown

Thanks @pablogsal for the PR ๐ŸŒฎ๐ŸŽ‰.. I'm working now to backport this PR to: 3.15.
๐Ÿ๐Ÿ’โ›๐Ÿค–

@bedevere-app

bedevere-app Bot commented May 25, 2026

Copy link
Copy Markdown

GH-150420 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants