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.41k stars 286 forks source link

mangohud.conf file causes segfaults #160

Closed Termuellinator closed 3 years ago

Termuellinator commented 4 years ago

I've noticed that some games started crashing after the update to 0.3.5, during testing i discovered that mangohud is the culprit. I mostly tested with lutris (because i have global MANGOHUD=1 lutris immediately segfaulted), so there might be some edge-cases elsewhere. I first thought that maybe the config syntax changed, but even with only cpu_stats in ~/.config/MangoHud/MangoHud.conf the segfault occured. When i export my normal config into MANGOHUD_CONFIG, everything works fine. As nobody else reported this i'm unsure what to do next to track this down?

flightlessmango commented 4 years ago

does it segfault with vkcube? in that case, a gdb log could be useful mangohud gdb vkcube press r and then enter

Termuellinator commented 4 years ago

vkcube doesn't segfault, no :/ i just tested moving my config from ~/.config/MangoHud/MangoHud.conf to /usr/bin/MangoHud.conf, that way lutris is starting. The games i tested run, too - unfortunately, they revert back to the defaults and don't seem to read the config. The games are all either proton-based or run from lutris with wine (i don't have any native vulkan game at hand i think)

jackun commented 4 years ago

Check if vkBasalt runs, might be something with c++ runtime.

Termuellinator commented 4 years ago

vkBasalt is enabled, too and doesn't seem to interfere

ghost commented 4 years ago

I also got segfaults with Lutris when there's a mangohud file now. I was having segfaults with the latest git of xow and the developer could track the problem down using "valgrind". So here is a valgrind trace of the lutris problem, don't know if it helps.

https://pastebin.com/FvkK3eWq

valters-tomsons commented 4 years ago

I also experienced segfaults in lutris with MANGOHUD=1 but for some mysterious reason, it just stopped doing it after a while.

ryester19 commented 4 years ago

Is everyone using Arch Linux, by any chance? I've set mangohud to automatically run through the Proton user_settings.py config file, and now about 75% of my games are crashing right after DXVK initializes

aHcVolle commented 4 years ago

Is everyone using Arch Linux, by any chance?

Yes using arch here and some games (e.g. Doom Eternal) started to crash after updating to 0.3.5 while others still work fine (BL3)

jackun commented 4 years ago

@aHcVolle out right at startup or after some time?

aHcVolle commented 4 years ago

@aHcVolle out right at startup or after some time? Outright

ghost commented 4 years ago

On intel haswell i'm getting segfault even on vkcube.

dmesg output

[20902.399750] vkcube[19222]: segfault at 0 ip 00007f941fe0f78a sp 00007ffc8a033d88 error 4 in libc-2.31.so[7f941fd96000+14c000]

jackun commented 4 years ago

@benjamimgois does 40255b62f9f63577dbd08b6fbdde49616c792abe fix it?

ghost commented 4 years ago

@jackun now there's no segfault, but i got this:

https://pastebin.com/5zmnSFCU

jackun commented 4 years ago

@benjamimgois wait, with commit 40255b62f9f63577dbd08b6fbdde49616c792abe ?

ghost commented 4 years ago

ops, sorry for my late @jackun i took the last git version. Do i have to manually apply this commit ? if yes, how do i do it ?

edit: Just tried the latest git again, and now it works !

flightlessmango commented 4 years ago

To the original problem of this issue, does it work to not have mangohud globally enabled and instead just enable it in lutris by adding it as a command prefix?

ghost commented 4 years ago

To the original problem of this issue, does it work to not have mangohud globally enabled and instead just enable it in lutris by adding it as a command prefix?

yes, it work. But i also noted that, if i let mangohud globally enabled and initiate lutris with:

mangohud lutris

it also works.

Glog78 commented 4 years ago

Maybe the following information i observed help:

case 1.) MANGOHUD=1 %command% works on 64bit game case 2.) MANGOHUD=1 %command% doesn't work on 32bit game -> crashes case 3.) mangohud.x86 %command% works on 32bit game edge case -> Grim Dawn (32bit spawns a 64bit executable) -> mangohud %command% works

i noticed the following line on a 32bit game which might be indicate something -> MANGOHUD: libXNVCtrl.so.0 dlopen failed: libXNVCtrl.so.0: cannot open shared object file: No such file or directory

<< this is totally understandable since arch only offers lbXNVCtrl for 64 bit not for 32bit but i dunno if this might be a issue

mikev190 commented 4 years ago

I'm also having the same issue

MANGOHUD: libXNVCtrl.so.0 dlopen failed: libXNVCtrl.so.0: cannot open shared object file: No such file or directory

Games work fine when I disable MangoHud

jackun commented 4 years ago

MANGOHUD: libXNVCtrl.so.0 dlopen failed: libXNVCtrl.so.0: cannot open shared object file: No such file or directory

is totally benign.

flightlessmango commented 4 years ago

@Termuellinator have you tried not having mangohud globally enabled?

@mikev190 This issue has to do with mangohud crashing when a config is used, is that the issue you're having?

Termuellinator commented 4 years ago

i think during testing i only tried to disable mangohud via mangohud=0 in the shell i ran lutris/steam from, but didn't remove it from /etc/envrionment iirc, no - you think that is making a difference?

flightlessmango commented 4 years ago

That seems to be somewhat of a theme, might be just coincidence.

I think it might be helpful if people could start listing some basic info like gpu, os + version, if they used the release packaged or built mangohud, and specific steps to reproduce the issue

Termuellinator commented 4 years ago

OK, i'll try it without global env next time i reboot. Will report back. I'm on Manjaro KDE + amd navi10 and using the AUR package.

Edit: yes, it also happens when it's not set globally but with "MANGOHUD=1 lutris"/"MANGOHUD=1 %command%"

mikev190 commented 4 years ago

@flightlessmango Yes, however I have found that disabling Vsync in the config helps with some games like Overwatch

I'm using Manjaro GNOME + GTX 1080ti 440.82

o-schneider commented 4 years ago

I have this issue too, happened out of nowhere without changing anything, and not with every program. Could reproduce it trying to launch The Witcher 3 or Divinity OS2. Removing the user configuration solved it.

OS : Arch Linux - 5.6.13-arch1-1 GPU : GTX 980 Ti - 440.66.14 I have an haswell CPU (i7 4770k), it was mentioned earlier so I figured it could be interesting.

DeathTBO commented 4 years ago

Is this the problem? Lately I've been having trouble with programs crashing. Wine installed Battle.net/Steam/GOG crash altogether, Monster Hunter World via Proton crashes unless I restart (Linux) Steam a number of times.

At first I thought it was DXVK because removing that seemed to fix the issues... However, I've come to discover it's actually MangoHUD. After removing MangoHUD -> DXVK and MHW immediately began working. This sucks cause I really like MangoHUD.

OS: Fedora 32 - Kernel 5.6.13 CPU: Ryzen 2700 GPU: 5700xt - Mesa 20.0.7 DE: KDE Plasma 5.18.5

On a side note, I noticed that the 32 bit version of MangoHud isn't in the Fedora repo, but is being built on Koji. I have to download and install it manually to use it on 32 bit programs.

adonisd commented 4 years ago

OS:

DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=20.0.1
DISTRIB_CODENAME=Lysia
DISTRIB_DESCRIPTION="Manjaro Linux"

Installed through AUR package: https://aur.archlinux.org/packages/mangohud/

Steps to reproduce issue: If MANGOHUD is enabled globally, several apps will crash (Discord, Lutris) to name a few. To launch them successfully, either disable MANGOHUD globally or launch with: MANGOHUD=0 lutris

flightlessmango commented 4 years ago

@adonisd does it work if you have it globally enabled but removing the config file?

@DeathTBO I need more details to determine if this is the same issue or another issue, does disabling mangohud globally fix it or removing the config file?

adonisd commented 4 years ago

@flightlessmango , yes removing my config file launches the app successfully:


➜ lutris
2020-05-23 15:36:01,902: Running Lutris 0.5.6
2020-05-23 15:36:01,903: Using NVIDIA drivers 440.82 for x86_64
2020-05-23 15:36:01,903: GPU: GeForce GTX 1080
2020-05-23 15:36:01,903: GPU: 10DE:1B80 1043:8593 using nvidia drivers
skipping config: /usr/bin/MangoHud.conf [ not found ]
skipping config: /home/adonis/.config/MangoHud/python3.8.conf [ not found ]
parsing config: /home/adonis/.config/MangoHud/MangoHud.conf [ ok ]
2020-05-23 15:36:01,942: Vulkan is supported
2020-05-23 15:36:01,943: Updating DXVK versions
[1]    25731 segmentation fault (core dumped)  lutris

~ 
➜ mv /home/adonis/.config/MangoHud/MangoHud.conf /home/adonis/.config/MangoHud/MangoHud.conf.BAK

~ 
➜ lutris
2020-05-23 15:36:39,073: Running Lutris 0.5.6
2020-05-23 15:36:39,073: Using NVIDIA drivers 440.82 for x86_64
2020-05-23 15:36:39,073: GPU: GeForce GTX 1080
2020-05-23 15:36:39,074: GPU: 10DE:1B80 1043:8593 using nvidia drivers
skipping config: /usr/bin/MangoHud.conf [ not found ]
skipping config: /home/adonis/.config/MangoHud/python3.8.conf [ not found ]
skipping config: /home/adonis/.config/MangoHud/MangoHud.conf [ not found ]
2020-05-23 15:36:39,106: Vulkan is supported
2020-05-23 15:36:39,107: Updating DXVK versions
2020-05-23 15:36:42,357: Shutting down Lutris

Here is the output of my config file just in case:

➜ cat /home/adonis/.config/MangoHud/MangoHud.conf.BAK 
################### File Generated by GOverlay ###################
#fps_limit=
vsync=1
gl_vsync=0
cpu_stats
cpu_temp
cpu_color=2e97cb
gpu_stats
gpu_temp
gpu_color=2e9762
ram
ram_color=c26693
vram_color=ad64c1
io_color=a491d3
frame_timing=1
frametime_color=00ff00
crosshair_color=000000
crosshair_size=20
no_display
background_alpha=0.4
font_size=24
background_color=020202
position=top-right
text_color=ffffff
toggle_hud=F12
toggle_logging=F2
output_file=/home/adonis/mangohud_log_
DeathTBO commented 4 years ago

I did a quick test. I launched MHW, fine no issues, I then reinstalled MangoHUD -> Crashed. After removing the config file it began working once again. I then renamed the same config file to something else, and used MANGOHUD_CONFIGFILE to point to it. This resulted in the same crash.

Finally after removing the config file altogether it began working.

jackun commented 4 years ago

What's you locale? It might be that stupid thing where std::istream suddenly don't know how to parse basic string.

adonisd commented 4 years ago

What's you locale? It might be that stupid thing where std::istream suddenly don't know how to parse basic string.

➜ cat /etc/locale.conf 
LANG=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_TIME=en_US.UTF-8
adonishycm commented 4 years ago

so I have a weird issue. I went in to do lldb with bt for you, and when I tested I saw that launching anything that would have been broken works. If you look at my example below. Running lutris outside of lldb segfaults with a conf file. running lutris from lldb works fine.

➜ lutris         
2020-06-04 16:36:24,683: Running Lutris 0.5.6
2020-06-04 16:36:24,683: Using NVIDIA drivers 440.82 for x86_64
2020-06-04 16:36:24,683: GPU: GeForce GTX 1080
2020-06-04 16:36:24,684: GPU: 10DE:1B80 1043:8593 using nvidia drivers
skipping config: /usr/bin/MangoHud.conf [ not found ]
skipping config: /home/adonis/.config/MangoHud/python3.8.conf [ not found ]
parsing config: /home/adonis/.config/MangoHud/MangoHud.conf [ ok ]
2020-06-04 16:36:24,790: Vulkan is supported
2020-06-04 16:36:24,791: Updating DXVK versions
[1]    244516 segmentation fault (core dumped)  lutris

~/.config/MangoHud 
➜ lldb
(lldb) target create "python"
Current executable set to 'python' (x86_64).
(lldb) run /usr/bin/lutris 
Process 244945 launched: '/usr/bin/python' (x86_64)
Process 244945 stopped and restarted: thread 1 received signal: SIGCHLD
Process 244945 stopped and restarted: thread 1 received signal: SIGCHLD
Process 244945 stopped and restarted: thread 1 received signal: SIGCHLD
Process 244945 stopped and restarted: thread 1 received signal: SIGCHLD
Process 244945 stopped and restarted: thread 1 received signal: SIGCHLD
2020-06-04 16:36:52,361: Running Lutris 0.5.6
2020-06-04 16:36:52,362: Using NVIDIA drivers 440.82 for x86_64
2020-06-04 16:36:52,362: GPU: GeForce GTX 1080
2020-06-04 16:36:52,363: GPU: 10DE:1B80 1043:8593 using nvidia drivers
skipping config: /usr/bin/MangoHud.conf [ not found ]
skipping config: /home/adonis/.config/MangoHud/python3.8.conf [ not found ]
parsing config: /home/adonis/.config/MangoHud/MangoHud.conf [ ok ]
2020-06-04 16:36:52,992: Vulkan is supported
2020-06-04 16:36:52,993: Updating DXVK versions
2020-06-04 16:36:56,816: Shutting down Lutris
Process 244945 exited with status = 0 (0x00000000) 

I copied this here, since this is where the issue is open and the other conversation was for a pull request.

adonishycm commented 4 years ago

@flightlessmango , @jackun if you have anything in mind that you would like me to do, please let me know.

Scrumplex commented 4 years ago

so I have a weird issue. I went in to do lldb with bt for you, and when I tested I saw that launching anything that would have been broken works. If you look at my example below. Running lutris outside of lldb segfaults with a conf file. running lutris from lldb works fine.

➜ lutris         
2020-06-04 16:36:24,683: Running Lutris 0.5.6
2020-06-04 16:36:24,683: Using NVIDIA drivers 440.82 for x86_64
2020-06-04 16:36:24,683: GPU: GeForce GTX 1080
2020-06-04 16:36:24,684: GPU: 10DE:1B80 1043:8593 using nvidia drivers
skipping config: /usr/bin/MangoHud.conf [ not found ]
skipping config: /home/adonis/.config/MangoHud/python3.8.conf [ not found ]
parsing config: /home/adonis/.config/MangoHud/MangoHud.conf [ ok ]
2020-06-04 16:36:24,790: Vulkan is supported
2020-06-04 16:36:24,791: Updating DXVK versions
[1]    244516 segmentation fault (core dumped)  lutris

~/.config/MangoHud 
➜ lldb
(lldb) target create "python"
Current executable set to 'python' (x86_64).
(lldb) run /usr/bin/lutris 
Process 244945 launched: '/usr/bin/python' (x86_64)
Process 244945 stopped and restarted: thread 1 received signal: SIGCHLD
Process 244945 stopped and restarted: thread 1 received signal: SIGCHLD
Process 244945 stopped and restarted: thread 1 received signal: SIGCHLD
Process 244945 stopped and restarted: thread 1 received signal: SIGCHLD
Process 244945 stopped and restarted: thread 1 received signal: SIGCHLD
2020-06-04 16:36:52,361: Running Lutris 0.5.6
2020-06-04 16:36:52,362: Using NVIDIA drivers 440.82 for x86_64
2020-06-04 16:36:52,362: GPU: GeForce GTX 1080
2020-06-04 16:36:52,363: GPU: 10DE:1B80 1043:8593 using nvidia drivers
skipping config: /usr/bin/MangoHud.conf [ not found ]
skipping config: /home/adonis/.config/MangoHud/python3.8.conf [ not found ]
parsing config: /home/adonis/.config/MangoHud/MangoHud.conf [ ok ]
2020-06-04 16:36:52,992: Vulkan is supported
2020-06-04 16:36:52,993: Updating DXVK versions
2020-06-04 16:36:56,816: Shutting down Lutris
Process 244945 exited with status = 0 (0x00000000) 

I copied this here, since this is where the issue is open and the other conversation was for a pull request.

I can confirm the same behavior with gdb. Tested this a few weeks ago

flightlessmango commented 4 years ago

Should be fixed in develop #204

adonisd commented 4 years ago

tested branch develop, can confirm working fine.

o-schneider commented 4 years ago

working here too, great!

flightlessmango commented 3 years ago

Seems fixed