libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.34k stars 1.84k forks source link

[Manjaro Linux] RetroArch crashes on startup after system update #16123

Closed tautologe closed 1 month ago

tautologe commented 10 months ago

Description

Hi, I use RetroArch on a Manjaro (Arch Linux based) Linux Laptop. RetroArch is installed from the official arch repository (extra). This setup was working for some weeks. Since the latest system update (including update of RetroArch, but also kernel and system libraries updates like lib32-mesa etc - I can provide more details if needed) RetroArch crashes during startup. When starting on the command line the following error is shown:

X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  26 (X_GLXMakeContextCurrent)
  Serial number of failed request:  2205
  Current serial number in output stream:  2205

Bisect Results

I tried to revert the following updates of retroarch packages (retroarch-assets-ozone (1:489-1 -> 1:495-1),retroarch-assets-glui (1:489-1 -> 1:495-1) , retroarch-assets-xmb (1:489-1 -> 1:495-1)) but this did not help, so I guess the error is triggered by some changes in the linux system.

I try to reinstall RetroArch (maintaining the configuration), but still got the error. Then I tried to install the flatpak version, which worked at first. Then I tried to update my configuration to the previous state and found, that after activating "Video in separate thread", RetroArch crashes with the same error message as above. I could also bring back my previous installation by changing video_threaded = "true" to false in the configuration file. But I do not really want to disable this setting, because it drastically improved the performance on my machine.

So the bug seems to be a result of the Video Thread setting and a change in the system environment.

Reproduce

  1. Install RetroArch on a current Manjaro Linux
  2. Activate "Video in separate thread"

Version/Commit

Environment information

gouchi commented 10 months ago

Hi,

Can you provide some debug log following this documentation ? At least with

git clone  https://github.com/libretro/RetroArch.git
cd RetroArch
./configure && make DEBUG=1  -j$(nproc)
gdb ./retroarch

Then enter r to launch RA then bt full when you get the crash.

Thank you.

tautologe commented 10 months ago
(gdb) run
Starting program: /home/***/RetroArch/retroarch 
[Thread debugging using libthread_db enabled]                                                                                                                                                                                                                           
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe29026c0 (LWP 30113)]                                                                                                                                                                                                                                 
[New Thread 0x7fffd74be6c0 (LWP 30114)]                                                                                                                                                                                                                                 
[New Thread 0x7fffd6cbd6c0 (LWP 30115)]
[New Thread 0x7fffd64bc6c0 (LWP 30116)]
[New Thread 0x7fffd5cbb6c0 (LWP 30117)]
[Detaching after vfork from child process 30118]
Can't locate Net/DBus.pm in @INC (you may need to install the Net::DBus module) (@INC entries checked: /usr/lib/perl5/5.38/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/5.38/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/5.38/core_perl /usr/share/perl5/core_perl) at -e line 6.
BEGIN failed--compilation aborted at -e line 6.
[New Thread 0x7fffd4dba6c0 (LWP 30149)]
[Thread 0x7fffd5cbb6c0 (LWP 30117) exited]
[Thread 0x7fffd64bc6c0 (LWP 30116) exited]
[Thread 0x7fffd4dba6c0 (LWP 30149) exited]
[New Thread 0x7fffd4dba6c0 (LWP 30150)]
[New Thread 0x7fffd64bc6c0 (LWP 30159)]
[New Thread 0x7fffd5cbb6c0 (LWP 30160)]
[New Thread 0x7fffbbfff6c0 (LWP 30161)]
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  26 (X_GLXMakeContextCurrent)
  Serial number of failed request:  1453
  Current serial number in output stream:  1453
[Thread 0x7fffd5cbb6c0 (LWP 30160) exited]
[Thread 0x7fffd64bc6c0 (LWP 30159) exited]
[Thread 0x7fffd6cbd6c0 (LWP 30115) exited]
[Thread 0x7fffd74be6c0 (LWP 30114) exited]
[Thread 0x7fffd4dba6c0 (LWP 30150) exited]
[Thread 0x7fffe29026c0 (LWP 30113) exited]
[Thread 0x7fffbbfff6c0 (LWP 30161) exited]
[Inferior 1 (process 30112) exited with code 01]
(gdb) bt full
No stack.
tautologe commented 10 months ago

I installed some perl libraries to get away the warnings, but still no stack:

(gdb) r
Starting program: /home/***/RetroArch/retroarch 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffe29026c0 (LWP 37333)]
[New Thread 0x7fffd74be6c0 (LWP 37334)]
[New Thread 0x7fffd6cbd6c0 (LWP 37335)]
[New Thread 0x7fffd64bc6c0 (LWP 37336)]
[New Thread 0x7fffd5cbb6c0 (LWP 37337)]
[Detaching after vfork from child process 37338]
[New Thread 0x7fffd4dba6c0 (LWP 37369)]
expected 2 params, but got 4 at /usr/lib/perl5/5.38/vendor_perl/Net/DBus/Binding/Introspector.pm line 1138.
[Thread 0x7fffd5cbb6c0 (LWP 37337) exited]
[Thread 0x7fffd64bc6c0 (LWP 37336) exited]
[Thread 0x7fffd4dba6c0 (LWP 37369) exited]
[New Thread 0x7fffd4dba6c0 (LWP 37371)]
[New Thread 0x7fffd64bc6c0 (LWP 37380)]
[New Thread 0x7fffd5cbb6c0 (LWP 37381)]
[New Thread 0x7fffbbfff6c0 (LWP 37382)]
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  26 (X_GLXMakeContextCurrent)
  Serial number of failed request:  2554
  Current serial number in output stream:  2554
[Thread 0x7fffd5cbb6c0 (LWP 37381) exited]
[Thread 0x7fffd64bc6c0 (LWP 37380) exited]
[Thread 0x7fffd6cbd6c0 (LWP 37335) exited]
[Thread 0x7fffd74be6c0 (LWP 37334) exited]
[Thread 0x7fffd4dba6c0 (LWP 37371) exited]
[Thread 0x7fffe29026c0 (LWP 37333) exited]
[Thread 0x7fffe2949e80 (LWP 37332) exited]
[Thread 0x7fffbbfff6c0 (LWP 37382) exited]
[New process 37332]
[Inferior 1 (process 37332) exited with code 01]
(gdb) bt full
No stack.
gouchi commented 10 months ago

I am sorry, I gave you wrong operation because you did not get a crash in the first place.

zoltanvb commented 10 months ago

Tried to replicate it, Manjaro for the RPi 4 (which I have at hand for a test platform) does not exhibit it, but it is also significantly behind on versions (kernel is 6.1.69-1).

Video context driver should log a few things, can you try enabling debug logging and then collecting a log both from successful startup without threaded video, and one from the error case? (This may require starting RA with "retroarch -v" to get the logs on screen, dumping to file may be omitted in case of crash.)

Also, what video driver do you use? Does it make a difference if you change it (gl, glcore, vulkan)?

tautologe commented 10 months ago

Hi,

I used gl. It also fails with glcore. But it works, when I change it to vulkan! It seems that I can work with this setting. Many thanks so far!

But still, I want to provide you the needed logs. These are the logs when starting retroarch with gl driver and without threaded video threaded:

[INFO] RetroArch 1.16.0 (Git 6c2cc45628)
[INFO] === Build =======================================
[INFO] CPU Model Name: Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz
[INFO] Fähigkeiten: MMX MMXEXT SSE SSE2 SSE3 SSSE3 SSE4 SSE42 AES AVX AVX2 
[INFO] Version: 1.16.0
[INFO] Git: 6c2cc45628
[INFO] Built: Oct  9 2023
[INFO] =================================================
[INFO] [Input]: Found input driver: "x".
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] [Core]: Version der Libretro-API: 1, Kompiliert gegen API: 1
[INFO] [Core]: Geometry: 320x240, Aspect: 1.333, FPS: 60.00, Sample rate: 48000.00 Hz.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Set video size to: 960x720.
[ERROR] [Wayland]: Failed to connect to Wayland server.
[INFO] [GLX]: GLX_EXT_swap_control_tear supported.
[INFO] [GL]: Found GL context: "x".
[INFO] [GL]: Detecting screen resolution: 3840x2160.
[INFO] [GLX]: X = 0, Y = 0, W = 960, H = 720.
[INFO] [GLX]: Found swap function: glXSwapIntervalEXT.
[INFO] [GL]: Vendor: Intel, Renderer: Mesa Intel(R) HD Graphics 5500 (BDW GT2).
[INFO] [GL]: Version: 4.6 (Compatibility Profile) Mesa 23.3.3-manjaro1.1.
[INFO] [GL]: Using ARB_sync to reduce latency.
[INFO] [GL]: Using resolution 960x720.
[INFO] [GL]: Default shader backend found: glsl.
[INFO] [Shader driver]: Using GLSL shader backend.
[INFO] [GLSL]: Checking GLSL shader support ...
[WARN] [GL]: Stock GLSL shaders will be used.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] Setting up menu pipeline shaders for XMB ...
[INFO] [GLSL]: Compiling ribbon shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling simple ribbon shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling snow shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling modern snow shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling bokeh shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling snowflake shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GL]: Using 4 textures.
[INFO] [GL]: Loaded 1 program(s).
[INFO] [GL]: Using GL_RGB565 for texture uploads.
[INFO] [udev]: Pad #0 (/dev/input/event20) supports 0 force feedback effects.
[INFO] [Autoconf]: 8BitDo SN30 Pro konfiguriert in Port 1.
[INFO] [Joypad]: Found joypad driver: "udev".
[INFO] [DBus]: Suspended screensaver via DBus.
[INFO] [Video]: Found display server: "x11".
[DEBUG] [PulseAudio]: Sink detected: alsa_output.pci-0000_00_1b.0.analog-surround-40
[INFO] [PulseAudio]: Requested 24576 bytes buffer, got 18432.
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [ALSA] Using ALSA version 1.2.10
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "gl".
[INFO] [Playlist]: Verlaufs-Datei wird geladen: ...

And if I then change threaded video to true, this happens:

[INFO] [XINERAMA]: Xinerama version: 1.1.
[INFO] [XINERAMA]: Xinerama screens: 1.
[INFO] [XINERAMA]: Saved monitor #0.
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Set video size to: 960x720.
[INFO] [Video]: Starting threaded video driver..
[ERROR] [Wayland]: Failed to connect to Wayland server.
[INFO] [GLX]: GLX_EXT_swap_control_tear supported.
[INFO] [GL]: Found GL context: "x".
[INFO] [GL]: Detecting screen resolution: 3840x2160.
[INFO] [GLX]: X = 0, Y = 0, W = 960, H = 720.
[INFO] [GLX]: Found swap function: glXSwapIntervalEXT.
[INFO] [GL]: Vendor: Intel, Renderer: Mesa Intel(R) HD Graphics 5500 (BDW GT2).
[INFO] [GL]: Version: 4.6 (Compatibility Profile) Mesa 23.3.3-manjaro1.1.
[INFO] [GL]: Using ARB_sync to reduce latency.
[INFO] [GL]: Using resolution 960x720.
[INFO] [GL]: Default shader backend found: glsl.
[INFO] [Shader driver]: Using GLSL shader backend.
[INFO] [GLSL]: Checking GLSL shader support ...
[WARN] [GL]: Stock GLSL shaders will be used.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] Setting up menu pipeline shaders for XMB ...
[INFO] [GLSL]: Compiling ribbon shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling simple ribbon shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling snow shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling modern snow shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling bokeh shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Compiling snowflake shader..
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GL]: Using 4 textures.
[INFO] [GL]: Loaded 1 program(s).
[INFO] [GL]: Using GL_RGB565 for texture uploads.
[INFO] [udev]: Pad #0 (/dev/input/event20) supports 0 force feedback effects.
[INFO] [Joypad]: Found joypad driver: "udev".
[INFO] [Video]: Found display server: "x11".
[DEBUG] [PulseAudio]: Sink detected: alsa_output.pci-0000_00_1b.0.analog-surround-40
[INFO] [PulseAudio]: Requested 24576 bytes buffer, got 18432.
[INFO] [Audio]: Started synchronous audio driver.
[INFO] [ALSA] Using ALSA version 1.2.10
[INFO] [Microphone]: Initialized microphone driver.
[INFO] [Display]: Found display driver: "gl".
X Error of failed request:  BadAccess (attempt to access private resource denied)
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  26 (X_GLXMakeContextCurrent)
  Serial number of failed request:  3841
  Current serial number in output stream:  3841
viachaslavic commented 7 months ago

Same on ArchLinux.

backtrace

Env:

UPD: @zoltanvb , reproduced with gl,gl1, and glcore video driver (attached log for glcore).

gouchi commented 6 months ago

@tautologe can you try to compile latest RA and report if the issue fixed ? As @viachaslavic provided a fix.

If it is the case, please close this issue.

Thank you.

tautologe commented 1 month ago

Hi, sorry for the late response and thanks @viachaslavic for the fix! I was not able to compile the source on my current system anymore (I guess there are some libraries moved or something like that).

But I also cannot reproduce this error anymore with the old packaged version 1.16.0 and the current 1.19.1 when switching back to "glcore" and activating "Video in separate thread". So I guess either the fix works and/or (for the old version) my system had updated in a way the issue is obsolete. So I consider this issue closed.

Thanks for everybody taking their time!