* perf: Live mode flamegraph recording results in segmentation fault
@ 2025-03-07 16:25 David
2025-03-10 11:53 ` James Clark
0 siblings, 1 reply; 4+ messages in thread
From: David @ 2025-03-07 16:25 UTC (permalink / raw)
To: peterz; +Cc: linux-perf-users
I've reproduced this on recent versions of Debian, Ubuntu, CentOS, and
Fedora,
and I used to be able to downgrade perf and it would work, but an early
enough
version of perf is no longer available from most package repositories.
Steps I have taken to reproduce:
1. Install perf from a distro package manager. ( `sudo dnf install perf`)
```
$ perf --version
perf version 6.13.5-200.fc41.x86_64)
```
2. Attempt a live flamegraph report:
```
$ perf script flamegraph ls
/usr/libexec/perf-core/scripts/python/bin/flamegraph-report: line 3:
1644 Segmentation fault (core dumped) perf script -s
"$PERF_EXEC_PATH"/scripts/python/flamegraph.py -- "$@"
```
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: perf: Live mode flamegraph recording results in segmentation fault
2025-03-07 16:25 perf: Live mode flamegraph recording results in segmentation fault David
@ 2025-03-10 11:53 ` James Clark
2025-03-10 21:30 ` Namhyung Kim
0 siblings, 1 reply; 4+ messages in thread
From: James Clark @ 2025-03-10 11:53 UTC (permalink / raw)
To: David; +Cc: linux-perf-users, Peter Zijlstra
On 07/03/2025 4:25 pm, David wrote:
> I've reproduced this on recent versions of Debian, Ubuntu, CentOS, and
> Fedora,
> and I used to be able to downgrade perf and it would work, but an early
> enough
> version of perf is no longer available from most package repositories.
>
> Steps I have taken to reproduce:
>
> 1. Install perf from a distro package manager. ( `sudo dnf install perf`)
>
> ```
> $ perf --version
>
> perf version 6.13.5-200.fc41.x86_64)
> ```
>
> 2. Attempt a live flamegraph report:
>
> ```
>
> $ perf script flamegraph ls
> /usr/libexec/perf-core/scripts/python/bin/flamegraph-report: line 3:
> 1644 Segmentation fault (core dumped) perf script -s
> "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -- "$@"
> ```
>
>
Hi David,
Are you able to bisect this to find the breaking commit?
Is this the full output you get? I'm not able to reproduce your exact
issue. I do see a bug with the template download prompt but it produces
more output than you have:
$ perf script flamegraph ls
Warning: Flame Graph template '/usr/share/d3-flame-graph/d3-
flamegraph-base.html' does not exist.
[...]
s = input("Do you wish to download a template from cdn.jsdelivr.net?
(this warning can be suppressed with --allow-download) [yn] ").lower()
OSError: [Errno 9] Bad file descriptor
Fatal Python error: handler_call_die: problem in Python trace event
handler
Python runtime state: initialized
Current thread 0x00007d1916afd400 (most recent call first):
<no Python frame>
Extension modules: apt_pkg (total: 1)
Aborted (core dumped)
But if I avoid the record/report wrapper and go straight to the script
it works:
$ perf record -g ls
$ perf script flamegraph.py
[...]
Do you wish to download a template from cdn.jsdelivr.net? (this
warning can be suppressed with --allow-download) [yn] y
dumping data to flamegraph.html
I'm wondering if the template prompt ever worked in conjunction with the
wrappers? Maybe they were only tested with the template already
installed, or the script was always used directly when the need for a
template was added.
Thanks
James
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: perf: Live mode flamegraph recording results in segmentation fault
2025-03-10 11:53 ` James Clark
@ 2025-03-10 21:30 ` Namhyung Kim
2025-03-11 10:23 ` James Clark
0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2025-03-10 21:30 UTC (permalink / raw)
To: James Clark; +Cc: David, linux-perf-users, Peter Zijlstra
On Mon, Mar 10, 2025 at 11:53:06AM +0000, James Clark wrote:
>
>
> On 07/03/2025 4:25 pm, David wrote:
> > I've reproduced this on recent versions of Debian, Ubuntu, CentOS, and
> > Fedora,
> > and I used to be able to downgrade perf and it would work, but an early
> > enough
> > version of perf is no longer available from most package repositories.
> >
> > Steps I have taken to reproduce:
> >
> > 1. Install perf from a distro package manager. ( `sudo dnf install perf`)
> >
> > ```
> > $ perf --version
> >
> > perf version 6.13.5-200.fc41.x86_64)
> > ```
> >
> > 2. Attempt a live flamegraph report:
> >
> > ```
> >
> > $ perf script flamegraph ls
> > /usr/libexec/perf-core/scripts/python/bin/flamegraph-report: line 3:
> > 1644 Segmentation fault (core dumped) perf script -s
> > "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -- "$@"
> > ```
> >
> >
>
> Hi David,
>
> Are you able to bisect this to find the breaking commit?
>
> Is this the full output you get? I'm not able to reproduce your exact issue.
> I do see a bug with the template download prompt but it produces more output
> than you have:
>
> $ perf script flamegraph ls
>
> Warning: Flame Graph template '/usr/share/d3-flame-graph/d3-
> flamegraph-base.html' does not exist.
> [...]
> s = input("Do you wish to download a template from cdn.jsdelivr.net?
> (this warning can be suppressed with --allow-download) [yn] ").lower()
> OSError: [Errno 9] Bad file descriptor
> Fatal Python error: handler_call_die: problem in Python trace event
> handler
> Python runtime state: initialized
>
> Current thread 0x00007d1916afd400 (most recent call first):
> <no Python frame>
>
> Extension modules: apt_pkg (total: 1)
> Aborted (core dumped)
>
> But if I avoid the record/report wrapper and go straight to the script it
> works:
>
> $ perf record -g ls
> $ perf script flamegraph.py
>
> [...]
> Do you wish to download a template from cdn.jsdelivr.net? (this
> warning can be suppressed with --allow-download) [yn] y
>
> dumping data to flamegraph.html
>
> I'm wondering if the template prompt ever worked in conjunction with the
> wrappers? Maybe they were only tested with the template already installed,
> or the script was always used directly when the need for a template was
> added.
I don't know but it didn't work well for me too. Maybe it should have
default 'y' for live mode.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: perf: Live mode flamegraph recording results in segmentation fault
2025-03-10 21:30 ` Namhyung Kim
@ 2025-03-11 10:23 ` James Clark
0 siblings, 0 replies; 4+ messages in thread
From: James Clark @ 2025-03-11 10:23 UTC (permalink / raw)
To: Namhyung Kim, Ian Rogers, agerstmayr
Cc: David, linux-perf-users, Peter Zijlstra
On 10/03/2025 9:30 pm, Namhyung Kim wrote:
> On Mon, Mar 10, 2025 at 11:53:06AM +0000, James Clark wrote:
>>
>>
>> On 07/03/2025 4:25 pm, David wrote:
>>> I've reproduced this on recent versions of Debian, Ubuntu, CentOS, and
>>> Fedora,
>>> and I used to be able to downgrade perf and it would work, but an early
>>> enough
>>> version of perf is no longer available from most package repositories.
>>>
>>> Steps I have taken to reproduce:
>>>
>>> 1. Install perf from a distro package manager. ( `sudo dnf install perf`)
>>>
>>> ```
>>> $ perf --version
>>>
>>> perf version 6.13.5-200.fc41.x86_64)
>>> ```
>>>
>>> 2. Attempt a live flamegraph report:
>>>
>>> ```
>>>
>>> $ perf script flamegraph ls
>>> /usr/libexec/perf-core/scripts/python/bin/flamegraph-report: line 3:
>>> 1644 Segmentation fault (core dumped) perf script -s
>>> "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -- "$@"
>>> ```
>>>
>>>
>>
>> Hi David,
>>
>> Are you able to bisect this to find the breaking commit?
>>
>> Is this the full output you get? I'm not able to reproduce your exact issue.
>> I do see a bug with the template download prompt but it produces more output
>> than you have:
>>
>> $ perf script flamegraph ls
>>
>> Warning: Flame Graph template '/usr/share/d3-flame-graph/d3-
>> flamegraph-base.html' does not exist.
>> [...]
>> s = input("Do you wish to download a template from cdn.jsdelivr.net?
>> (this warning can be suppressed with --allow-download) [yn] ").lower()
>> OSError: [Errno 9] Bad file descriptor
>> Fatal Python error: handler_call_die: problem in Python trace event
>> handler
>> Python runtime state: initialized
>>
>> Current thread 0x00007d1916afd400 (most recent call first):
>> <no Python frame>
>>
>> Extension modules: apt_pkg (total: 1)
>> Aborted (core dumped)
>>
>> But if I avoid the record/report wrapper and go straight to the script it
>> works:
>>
>> $ perf record -g ls
>> $ perf script flamegraph.py
>>
>> [...]
>> Do you wish to download a template from cdn.jsdelivr.net? (this
>> warning can be suppressed with --allow-download) [yn] y
>>
>> dumping data to flamegraph.html
>>
>> I'm wondering if the template prompt ever worked in conjunction with the
>> wrappers? Maybe they were only tested with the template already installed,
>> or the script was always used directly when the need for a template was
>> added.
>
> I don't know but it didn't work well for me too. Maybe it should have
> default 'y' for live mode.
>
> Thanks,
> Namhyung
>
Looks like this bug was discussed previously here [2].
And the issue about shipping vs downloading here along with prompting on
the original change [1]. But considering the following I think it's
worth bringing it up again:
* We download a fixed version (rather than latest)
* The contents are hash checked so are fixed for that reason too
* We know network requests should be avoided (so prompt for input)
* The packaging request didn't go anywhere
In light of all of the above what's the difference between downloading
it vs packaging it into Perf? It has an Apache licence, but I'm pretty
sure it's separate enough for that to not be an issue.
One argument was that it's a minimized blob, but only the .min.js is.
The unminimized version is available too.
[1]:
https://lore.kernel.org/lkml/928c76bf-39bc-cbc0-373e-70c5561cd5b0@redhat.com/T/#mf0942ae7abc78882c9b10b1c1f18a119393e3e2b
[2]:
https://lore.kernel.org/all/CAP-5=fW+jpi_iLCrpA2GeEQBzNYASF52qrX7ExrSNL82uaDREQ@mail.gmail.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-03-11 10:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 16:25 perf: Live mode flamegraph recording results in segmentation fault David
2025-03-10 11:53 ` James Clark
2025-03-10 21:30 ` Namhyung Kim
2025-03-11 10:23 ` James Clark
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).