How to run heaptrack against gnome-shell?

F31, gnome-shell 3.34.3

I am experiencing a memory leek with gnome-shell and therefore want to run heaptrack against gnome-shell. Unfortunately, this does not work for me (heaptrack works perfectly fine with all other applications). Things I have tried:

  • heaptrack -p $(pidof gnome-shell) --> Results in ptrace: Operation not permitted., even though /proc/sys/kernel/yama/ptrace_scope is 0. Furthermore, I tried setcap cap_sys_ptrace=eip /usr/bin/gdb, which does not work under Fedora as /usr/bin/gdb is actually a symbolic link to /usr/libexec/gdb. So I did, setcap cap_sys_ptrace=eip /usr/libexec/gdb, but I still get ptrace: Operation not permitted.

  • sudo heaptrack -p $(pidof gnome-shell) --> Results in ERROR: failed to open heaptrack output file /tmp/heaptrack_fifo36227: Permission denied (13) in the gnome-shell journal.

In both cases the heaptrack file has a size of 0 byte.
Does anyone have any ideas how this is supposed to work?

Can anyone give me a pointer where to look for it at least?

This is probably down to “setcap CAP_SYS_NICE=+ep” set on the gnome-shell binary, It’s known to have prevented ptrace in other situations. You can probably undo that for testing purposes.

I only tried heaptrack with gnome-shell from my jhbuild setup, but "heaptrack -p pidof gnome-shell" just worked for me (“CFLAGS=-g -O -fno-omit-frame-pointer” in my environment might also have something to do in backtrace correctness, but that’s an step ahead)

Cheers,
Carlos

Thanks Carlos.

That was indeed the problem. After removing the capabilities the insertion of heaptrack worked perfectly fine.