Commit 0f17e0b
committed
gh-150387: Fix hang in test_run_failed_script_live on slow buildbots
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.1 parent 0851700 commit 0f17e0b
2 files changed
Lines changed: 6 additions & 2 deletions
File tree
- Lib/test/test_profiling/test_sampling_profiler
- Misc/NEWS.d/next/Tests
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
835 | 835 | | |
836 | 836 | | |
837 | 837 | | |
838 | | - | |
839 | | - | |
| 838 | + | |
840 | 839 | | |
841 | 840 | | |
842 | 841 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments