Skip to content

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

Open
pablogsal wants to merge 1 commit into
python:mainfrom
pablogsal:fix-gh-150387-test-run-failed-script-live-hang
Open

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

Conversation

@pablogsal
Copy link
Copy Markdown
Member

@pablogsal pablogsal commented May 25, 2026

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review needs backport to 3.15 pre-release feature fixes, bugs and security fixes tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants