Perf on release fails with default optimizations

#1

I’m trying to profile my rust program in release mode with perf, but I keep stumbling upon this error when I run perf report: 0x2c80ec8 [0x8]: failed to process type: 68

I’ve been searching for a solution but all I’ve found is suggestions to use --call-graph=dwarf when running perf record, which I’m already doing, and enabling debug symbols on release, which I’m also already doing with the following:

[profile.release]
debug = true

Debug builds profile fine, as do release builds when I set opt-level=1 (which sorta defeats the point). Any ideas?

Edit: I’m using unstable features so I’m on nightly, more specifically rustc 1.35.0-nightly (96d700f1b 2019-04-10)

0 Likes

#2

I’m going to guess you’re on a Debian machine or a Debian-derived distro, such as Ubuntu.

Perf is broken on Debian. You can reduce the frequency of this failure by capturing less data and/or adding --no-demangle to the report command line

Or, if you have access to a machine running a different distro, profile your program there. (I can vouch for this not happening on my Arch machine, but it happens reliably on my employer’s Debian systems.)

0 Likes

#3

I’ve definitely seen this happen on my Arch machine, but I cannot reliably reproduce it and it only happens when I use --call-graph=dwarf. If it happens, I can sometimes rerun the command and have it work.

0 Likes

#4

I am actually running Arch myself. I just went and did a full system update just in case I accidentally did a partial update before, but sadly it still fails consistently.
I’m running perf version 5.0.g1c163f4.

Adding --no-demangle lets report finish correctly, and while I’d like to find a better solution I suppose can always figure out how to demangle the symbols myself.

As an alternative, --call-graph=lbr works, and while I’m not sure if my call stacks are too deep for it I can always check them in debug mode profiles to be sure.

0 Likes