flightlessmango / MangoHud

A Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more. Discord: https://discordapp.com/invite/Gj5YmBb
MIT License
6.39k stars 282 forks source link

Mangohud crashing native Wayland OpenGL/Vulkan apps while spamming logging mode #1353

Closed OlegAckbar closed 3 months ago

OlegAckbar commented 3 months ago

Describe the bug When I start ANY native Wayland applications with Mangohud it automatically starts and stops logging mode and then causes applications to crash (floating point exception).

List relevant hardware/software information Operating System: Arch Linux KDE Plasma Version: 6.0.5 KDE Frameworks Version: 6.3.0 Qt Version: 6.7.1 Kernel Version: 6.9.4-2-cachyos (64-bit) Graphics Platform: Wayland Processors: 8 × Intel® Core™ i7-7700K CPU @ 4.20GHz Memory: 15.6 ГиБ of RAM Graphics Processor: AMD Radeon RX 6700 XT

Name : mangohud Version : 0.7.2-1.2

Screenshots Запись экрана_20240613_231610.webm

flightlessmango commented 3 months ago

But it doesn't happen with x11 apps?

OlegAckbar commented 3 months ago

@flightlessmango no, it doesn't

OlegAckbar commented 3 months ago

I found the source of the issue. Setting toggle_logging= (I just want to unset logging keybind since I don't use logging) will cause that behavior (only on Wayland). Here's my MangoHud.conf.

OlegAckbar commented 3 months ago

Well, after commenting and then uncommenting toggle_logging= I can't reproduce this anymore... UPD: nvm the issue is back. The workaround would be commenting toggle_logging= line.

Kagukara commented 3 months ago

This seems like a very similar issue to what I'm having, but I don't have to spam the logging mode and it does it with all applications.

Running mangohud glxgears then press the toggle_logging keybind once causes a Floating point exception (core dumped).

Here's what mangohud gdb glxgears provides after pressing the toggle_logging keybind:

Thread 1 "glxgears" received signal SIGFPE, Arithmetic exception.
0x00007ffff7c52e64 in ?? () from /usr/lib/mangohud/libMangoHud_opengl.so

The backtrace:

#0  0x00007ffff7c52e64 in ?? () from /usr/lib/mangohud/libMangoHud_opengl.so
#1  0x00007ffff7c53c0d in ?? () from /usr/lib/mangohud/libMangoHud_opengl.so
#2  0x00007ffff7c58a79 in ?? () from /usr/lib/mangohud/libMangoHud_opengl.so
#3  0x00007ffff7c266a4 in ?? () from /usr/lib/mangohud/libMangoHud_opengl.so
#4  0x00007ffff7c2df9f in ?? () from /usr/lib/mangohud/libMangoHud_opengl.so
#5  0x00007ffff7c2e1ef in glXSwapBuffers () from /usr/lib/mangohud/libMangoHud_opengl.so
#6  0x0000555555556642 in draw_frame (win=<optimized out>, dpy=<optimized out>) at ../mesa-demos-9.0.0/src/xdemos/glxgears.c:345
#7  event_loop (win=4194306, dpy=0x555555570370) at ../mesa-demos-9.0.0/src/xdemos/glxgears.c:771
#8  main (argc=<optimized out>, argv=<optimized out>) at ../mesa-demos-9.0.0/src/xdemos/glxgears.c:875
flightlessmango commented 3 months ago

@Kagukara can you get a backtrace with debug build of mangohud?

Kagukara commented 3 months ago
$ file /usr/lib/mangohud/lib32/libMangoHud.so
/usr/lib/mangohud/lib32/libMangoHud.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=18012489232ac5972ceceb3db6cdf1e63dd3dd3a, with debug_info, not stripped

$ mangohud --version
v0.7.2-18-g193fdc7

Here's what mangohud gdb glxgears provides after pressing the toggle_logging keybind:

Thread 1 "glxgears" received signal SIGFPE, Arithmetic exception.
0x00007ffff76b785a in writeSummary (filename="/home/richard/.config/MangoHud/mangologs//glxgears_2024-06-23_13-58-11_summary.csv") at ../../src/logging.cpp:139
139    result = total_gpu_temp / sorted.size();

The backtrace:

#0  0x00007ffff76b785a in writeSummary (filename="/home/richard/.config/MangoHud/mangologs//glxgears_2024-06-23_13-58-11_summary.csv") at ../../src/logging.cpp:139
#1  0x00007ffff76b8c4f in Logger::stop_logging (this=0x55555558b2b0) at ../../src/logging.cpp:268
#2  0x00007ffff769ed21 in parse_overlay_config (params=0x7ffff7e25440 <MangoHud::GL::params>, env=0x0, use_existing_preset=true) at ../../src/overlay_params.cpp:997
#3  0x00007ffff76b525d in check_keybinds (params=..., vendorID=4098) at ../../src/keybinds.cpp:68
#4  0x00007ffff763b964 in MangoHud::GL::imgui_render (width=300, height=300) at ../../src/gl/gl_hud.cpp:218
#5  0x00007ffff76426a6 in do_imgui_swap (dpy=0x555555570410, drawable=0x400002) at ../../src/gl/inject_glx.cpp:161
#6  0x00007ffff7642706 in glXSwapBuffers (dpy=0x555555570410, drawable=0x400002) at ../../src/gl/inject_glx.cpp:168
#7  0x0000555555556642 in draw_frame (win=<optimized out>, dpy=<optimized out>) at ../mesa-demos-9.0.0/src/xdemos/glxgears.c:345
#8  event_loop (win=4194306, dpy=0x555555570410) at ../mesa-demos-9.0.0/src/xdemos/glxgears.c:771
#9  main (argc=<optimized out>, argv=<optimized out>) at ../mesa-demos-9.0.0/src/xdemos/glxgears.c:875
flightlessmango commented 3 months ago

attempted to fix it here df61c6602f78671d2dfb7863ce87d6455ffb00d7

Kagukara commented 3 months ago

That fixed the crash but mangohud doesn't make a log file in the set output_folder= and just toggles between different appearances. Its not doing any logging.

Below are 3/5 different appearances that you toggle through when pressing the `toggle_logging` keybind. 2/5 not below having no overlay and default. ![capture_2024-06-23_14-34-53](https://github.com/flightlessmango/MangoHud/assets/43391109/58a41c80-33ab-4560-853d-29aaf67ac6db) ![capture_2024-06-23_14-34-47](https://github.com/flightlessmango/MangoHud/assets/43391109/bd8ec3d1-651d-462b-bb48-e18d5778ee4b) ![capture_2024-06-23_14-34-37](https://github.com/flightlessmango/MangoHud/assets/43391109/66a8645c-9678-4faf-9a52-d774ac160e7c)
Kagukara commented 3 months ago

When the toggle_logging keybind is pressed, in the terminal is says this about the logging:

[2024-06-23 14:42:47.343] [MANGOHUD] [debug] [overlay_params.cpp:996] Stopped logging because config reloaded
[2024-06-23 14:42:47.343] [MANGOHUD] [debug] [logging.cpp:245] Logger constructed!
flightlessmango commented 3 months ago

It seems like you have bound reloading config and toggle logging to the same key

Kagukara commented 3 months ago

My "INTERACTION" section in the MangoHud.conf is setup like this:

################ INTERACTION #################

### Change toggle keybinds for the hud & logging
toggle_hud=Shift_R+F9
toggle_hud_position=Shift_R+F11
toggle_fps_limit=Shift_R+F8
toggle_logging=Shift_R+F10
# reload_cfg=Shift_L+F4
# upload_log=Shift_L+F3

Nothing seems conflicting between reloading config and toggling logging.

flightlessmango commented 3 months ago

It's because you haven't rebound toggle_preset, it's Shift_R+F10 by default and assigning it to another toggle doesn't unbind it

Kagukara commented 3 months ago

Ah, didn't know that was an option as its not in the: https://github.com/flightlessmango/MangoHud/blob/master/data/MangoHud.conf

Thank you for the help.

flightlessmango commented 3 months ago

Appears to be resolved