How to diagnose GTK application freezes under Flatpak?

I develop a GTK application. On the host it runs fine, but on Flatpak it sometimes has short ~0.3 s freezes of the UI that I’d like to diagnose. I’ve tried recording it with sysprof (both within Builder and with sysprof-cli --gtk --use-trace-fd -- flatpak run --devel my.application.Here), but org.gnome.Sdk seems to be missing counters so I can’t tell when the freezes actually occur in the recording, and I don’t see anything odd in the backtraces as is. How can I diagnose issues like this?

I’m using org.gnome.Sdk//3.38 and can build the application inside and outside of Builder. I’m on Fedora 33, Wayland.

If you are asking how to debug issues within flatpak environment, you can do the following.

Below is what I use for debugging rhythmbox within flatpak

$ flatpak run --command=sh --branch=master --devel org.gnome.Rhythmbox3

[📦 org.gnome.Rhythmbox3 ~]$ 

[📦 org.gnome.Rhythmbox3 ~]$ gdb
GNU gdb (GDB) 9.2
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

(gdb)

Thanks!

I am familiar with using gdb inside Flatpak. I’m specifically asking how to diagnose short GTK freezes; short enough that I can’t just switch to the terminal and Ctrl-C gdb at the right moment to see the backtrace.

You can use Sysprof to identify main loop stalls.

We plan on eventually enabling sysproof builds in the Runtime itself.

https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/294

1 Like

This seems like it will help; it’s giving me a lot of trouble trying to use it for a Flatpak application though. It needs to LD_PRELOAD its libsysprof-speedtrack-4.so (which isn’t present under Flatpak). I added sysprof to my Flatpak manifest so now I have the library in my /app/lib but it still doesn’t seem to work correctly.