Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 2/2] perf test: Test perf timechart --live
Date: Wed, 14 Oct 2026 04:28:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-170827@kernel.org> (raw)
In-Reply-To: <20261014042249.2379829-3-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] perf/tests: test hang due to missing FakeRecorder cleanup on error paths
--

commit 160f73df934f65800928fbfdebb9b1aabb7e4e95
Author: Alice Rogers <alice.mei.rogers@gmail.com>

perf test: Test perf timechart --live

This commit extends test_ttimechart_python.sh to validate the --live option.
It exercises LiveRecorder's perf record subprocess, control pipe, output file,
and introduces a synthetic live UI test for checking the rolling window,
pruning, and zoom tracking features.

> diff --git a/tools/perf/tests/shell/test_ttimechart_python.sh b/tools/perf/tests/shell/test_ttimechart_python.sh
> index 87b91ed8fc167..495060586cfc2 100755
> --- a/tools/perf/tests/shell/test_ttimechart_python.sh
> +++ b/tools/perf/tests/shell/test_ttimechart_python.sh

[ ... ]

> +test_live_synthetic() {
> +	echo "ttimechart live UI test (synthetic)"
> +	# Exercise live mode's rolling window, pruning, pause/resume and
> +	# following with a fake recorder, which doesn't need tracepoint
> +	# permissions.
> +	if ! "$PYTHON" - > "${output}" 2>&1 <<'EOF'
> +import asyncio
> +import threading

[ ... ]

> +        cur = 0
> +        while not rec.stopped.is_set() and not rec.finish:
> +            now = monotonic_ns()
> +            if rec.paused:
> +                time.sleep(0.01)
> +                continue

[ ... ]

> +    tc.read_events = fake_read
> +    app = tc.TimechartApp("live", False, False, [], live=rec, window=1.0)
> +    async with app.run_test(size=(120, 40)) as pilot:
> +        for _ in range(300):
> +            with app.data.lock:
> +                if app.data.pruned_to > rec.origin + 3000:
> +                    break
> +            await pilot.pause(0.05)
> +        with app.data.lock:
> +            if app.data.pruned_to <= rec.origin + 3000 or 300 in app.data.tasks:
> +                raise RuntimeError("Task outside the window was not pruned")

[Severity: Medium]
Will this cause the test suite to hang if an exception is raised here?

Because fake_read runs in a background thread and its loop relies on
rec.stopped.is_set() or rec.finish, an exception (like RuntimeError
on a failed assertion) will abort the test logic without executing
rec.finish = True or calling rec.stop().

This lack of cleanup leaves the background thread looping indefinitely and
prevents the Python interpreter from exiting. Other tests introduced in this
patch like test_no_events and test_live_record use try...finally blocks
to ensure rec.stop() is always called. 

Should a similar pattern be applied here to guarantee termination?

> +            starts = [t.segs.starts[0] for t in app.data.tasks.values() if len(t.segs)]
> +            if not starts or min(starts) < app.data.pruned_to:
> +                raise RuntimeError(f"Unpruned segments: {starts} < {app.data.pruned_to}")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014042249.2379829-1-irogers@google.com?part=2

      reply	other threads:[~2026-10-14  4:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 18:26 [PATCH v1 00/13] perf timechart/list/treport: Interactive Textual TUIs and perf python session improvements Ian Rogers
2026-10-02 18:26 ` [PATCH v1 01/13] perf session: Don't flush remaining events once processing is done Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 02/13] perf python: Quietly stop processing events when a callback raises Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 03/13] perf python: Lazily copy events and samples from process_events Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 04/13] perf python: Lazily resolve sample callchains Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 05/13] perf python: Release the GIL while processing session events Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 06/13] perf list: Add a --tui option to launch ilist Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 07/13] perf test: Add a test for the ilist script Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 08/13] perf treport: Show the profile while it loads Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-03  9:31   ` Arnaldo Carvalho de Melo
2026-10-02 18:26 ` [PATCH v1 09/13] perf test: Add a test for the treport script Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-03  9:35   ` Arnaldo Carvalho de Melo
2026-10-02 18:26 ` [PATCH v1 10/13] perf timechart: Add an interactive --tui mode Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 11/13] perf test: Add a test for perf timechart --tui Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 12/13] perf timechart: Add a --live mode to the TUI Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-02 18:26 ` [PATCH v1 13/13] perf test: Test perf timechart --live Ian Rogers
2026-10-03  1:33   ` sashiko-bot
2026-10-03  9:10 ` [PATCH v1 00/13] perf timechart/list/treport: Interactive Textual TUIs and perf python session improvements Arnaldo Carvalho de Melo
2026-10-03  9:12   ` Arnaldo Carvalho de Melo
2026-10-03  9:15     ` Arnaldo Carvalho de Melo
2026-10-14  4:22       ` [PATCH v2 0/2] perf timechart: Add --live mode to the TUI and test Ian Rogers
2026-10-14  4:22         ` [PATCH v2 1/2] perf timechart: Add a --live mode to the TUI Ian Rogers
2026-10-14  4:35           ` sashiko-bot
2026-10-14  4:22         ` [PATCH v2 2/2] perf test: Test perf timechart --live Ian Rogers
2026-10-14  4:28           ` sashiko-bot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-170827@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=irogers@google.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox