MangoHud: Crashing when enabled

Just got an update for mangohud-git from the AUR, now whenever I press the keybind to enable or when no_display is commented out, it crashed the program/game.

$ mangohud glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
/usr/include/c++/13.2.1/bits/stl_vector.h:1125: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = float; _Alloc = std::allocator<float>; reference = float&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted (core dumped)

Switching over to the non AUR package, programs/games do not crash.

List relevant hardware/software information

  • OS: Arch Linux
  • Mangohud Version: v0.7.1-rc1-2-g1d357e1
  • GPU: AMD Radeon RX 7900 XTX (radeonsi, navi31, LLVM 18.0.0, DRM 3.54, 6.6.7-arch1-1)
  • GPU Driver: 4.6 Mesa 24.0.0-devel (git-8023ede00a)

To Reproduce Steps to reproduce the behavior:

  1. run mangohud glxgears in the terminal
  2. Enable mangohud with your keybind or if you have no_display commented out glxgears will crash.

Expected behavior For the application to not crash and for MangoHud to show the statistics I want to see in the overlay.

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 36 (9 by maintainers)

Most upvoted comments

This should hopefully resolve the issue 3cee6f1

That seems to have fixed the problem. Thank you.

Now they start working, seems like after x amount of time like with the crash it starts to work as normal but this time it doesn’t crash.

image

Got round to running gdb for this issue of MangoHud which only crashes on a freshly booted PC, with either fps_metrics=avg,0.01 or fps_metrics=avg,0.01,0.001 set. Running mangohub vkcube to get the crash.

I’m not sure if this is the right way to use gdb but its how I was told in a past issue.

First I ran this in the terminal:

if ! grep -qi 'kernel.core_pattern' /etc/sysctl.conf; then
  sudo sh -c 'echo "kernel.core_pattern=core.%p.%u.%s.%e.%t" >> /etc/sysctl.conf'
  sudo sysctl -p
fi
ulimit -c unlimited

Then I ran mangohud vkcube which generated a file called core.2738.1000.6.vkcube.1705524812

Then I wasn’t sure if this was correct but its what I did next:

$ gdb mangohud core.2738.1000.6.vkcube.1705524812 
GNU gdb (GDB) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
"/usr/bin/mangohud": not in executable format: file format not recognized

warning: Can't open file /memfd:xshmfence (deleted) during file-backed mapping note processing
[New LWP 2744]
[New LWP 2738]
[New LWP 2752]
[New LWP 2758]
[New LWP 2743]
[New LWP 2756]
[New LWP 2757]

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.archlinux.org>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
                                                                                              
warning: Section `.reg-xstate/2744' in core file too small.
Core was generated by `vkcube'.                                                               
Program terminated with signal SIGABRT, Aborted.

warning: Section `.reg-xstate/2744' in core file too small.
#0  0x000072f4ad1fe83c in ?? ()
[Current thread is 1 (LWP 2744)]
(gdb) bt
#0  0x000072f4ad1fe83c in ?? ()
#1  0x000072f49bdffcf0 in ?? ()
#2  0x60ca1d64e4d43800 in ?? ()
#3  0x0000000000000006 in ?? ()
#4  0x000072f49be006c0 in ?? ()
#5  0x000072f49bdffc70 in ?? ()
#6  0x000072f49bdffcf0 in ?? ()
#7  0x000072f49bdffd00 in ?? ()
#8  0x000072f4ad1ae668 in ?? ()
#9  0x000072f4ad349b50 in ?? ()
#10 0x000072f4ad1964b8 in ?? ()
#11 0x0000000000000020 in ?? ()
#12 0x000072f4a1085098 in ?? ()
#13 0x0000000000000465 in ?? ()
#14 0x000072f4a1087ad0 in ?? ()
#15 0x000072f49bdffeb0 in ?? ()
#16 0x000072f49bdffd70 in ?? ()
#17 0x0000000000000001 in ?? ()
#18 0x000072f49bdffd00 in ?? ()
#19 0x000072f49bdffbc0 in ?? ()
#20 0x000072f4a0fd6a35 in ?? ()
#21 0x000072f4a1099b13 in ?? ()
#22 0x0000000000000000 in ?? ()
(gdb) 

Hope this helps.

EDIT: When I finished this comment I tried again with fps_metrics=avg,0.01,0.001 set and ran mangohud vkcube and it didn’t crash. My systems uptime is 16 mins.

I haven’t been able to repro it. It would be very useful if you could compile a debug version of mangohud and get a gdb back trace of the crash

Mangohud should not be used with gamescope, it’s not supported and any crashes are unlikely to be fixed. Instead you should use mangoapp

I’m experiencing this when fps_metricsis enabled in config if I compile with LTO enabled with GCC. Enabling LTO with clang(16) is a compile fail. LTO disabled, everything seems to work fine with both compilers.

My config

EDIT I tested this compiling 2 times with both before posting this, and then after posting, 3rd time trying with GCC LTO it worked just fine. Either I’m wrong and my results were just coincidence, and/or it’s randomly intermittent as stated above. EDIT2 Well nevermind! The GCC LTO build broke again after a reboot. I won’t be digging deeper into this for now