ppy / osu-framework

A game framework written with osu! in mind.
MIT License
1.65k stars 416 forks source link

SDL3: Segfault on wayland backend #6238

Closed FreezyLemon closed 6 months ago

FreezyLemon commented 6 months ago

With SDL_VIDEO_DRIVER=wayland or SDL_VIDEO_DRIVER unset, SDL3.SDL_Init segfaults:

$ dotnet ./osu.Framework.Tests.dll
[runtime] 2024-04-11 22:20:36 [verbose]: 🖼 Configuration renderer choice: Automatic
[runtime] 2024-04-11 22:20:36 [verbose]: 🖼 Renderer fallback order: [ OpenGL, OpenGL (Experimental), Vulkan (Experimental) ]
[runtime] 2024-04-11 22:20:36 [verbose]: 🖼 Initialising "GL" renderer with "OpenGL" surface
[1]    106779 segmentation fault (core dumped)  dotnet ./osu.Framework.Tests.dll

Setting SDL_VIDEO_DRIVER=x11 fixes this. Building my own SDL3 library from git main also fixes this (even duplicating the build args from the CI script).

I assume this is some problem with native dependencies because I am on a rolling release distro (Arch). I can't see anything wrong at a glance. I might dig deeper in the next few days.

smoogipoo commented 6 months ago
  1. Can you find the error in journalctl?
  2. uname -r?
  3. ldd --version?
  4. Does the official build from https://github.com/libsdl-org/SDL/actions/runs/8655570884 (specifically, the SDL-ubuntu20.04 artifact) work?
  5. I might be able to analyse more with the coredump if you send it to dump@smgi.me.

I'm using Arch + Hyprland and I can't repro, so there has to be something specific going wrong with your system.

smoogipoo commented 6 months ago

If (4) works from above, can you also try the lib from here? https://github.com/smoogipoo/SDL3-CS/pull/17/files

FreezyLemon commented 6 months ago
1. journalctl Apr 12 14:11:01 thinkpad-x13 kernel: dotnet[22185]: segfault at 0 ip 00007f8dcd37782f sp 00007ffcf1bc23f8 error 4 in libc.so.6[7f8dcd242000+15b000] likely on CPU 5 (core 2, socket 0) Apr 12 14:11:01 thinkpad-x13 kernel: Code: 2e 0f 1f 84 00 00 00 00 00 66 90 f3 0f 1e fa c4 41 01 ef ff 89 f8 09 f0 c1 e0 14 3d 00 00 00 f8 0f 87 25 03 00 00 c5 fe 6f 07 fd 74 0e c5 85 74 d0 c5 ed df c9 c5 fd d7 c9 ff c1 74 5d f3 0f Apr 12 14:11:01 thinkpad-x13 systemd[1]: Started Process Core Dump (PID 22199/UID 0). Apr 12 14:11:01 thinkpad-x13 systemd[1]: Started Pass systemd-coredump journal entries to relevant user for potential DrKonqi handling. Apr 12 14:11:02 thinkpad-x13 (sd-parse-elf)[22202]: Could not parse number of program headers from core file: invalid `Elf' handle Apr 12 14:11:02 thinkpad-x13 systemd-coredump[22200]: [🡕] Process 22185 (dotnet) of user 1000 dumped core. Module /home/jannik/Development/osu-framework/osu.Framework.Tests/bin/Debug/net8.0/runtimes/linux-x64/native/libbass.so without build-id. Module /home/jannik/Development/osu-framework/osu.Framework.Tests/bin/Debug/net8.0/runtimes/linux-x64/native/libbass.so Stack trace of thread 22185: #0 0x00007f8dcd37782f n/a (libc.so.6 + 0x15982f) #1 0x00007f8dc4f90041 n/a (/home/jannik/Development/osu-framework/osu.Framework.Tests/bin/Debug/net8.0/runtimes/linux-x64/native/libSDL3.so + 0x190041) ELF object binary architecture: AMD x86-64 Apr 12 14:11:02 thinkpad-x13 systemd[1]: systemd-coredump@3-22199-0.service: Deactivated successfully. Apr 12 14:11:02 thinkpad-x13 drkonqi-coredump-processor[22201]: "/home/jannik/.dotnet/dotnet" 22185 "/var/lib/systemd/coredump/core.dotnet.1000.53cd566ffe7045288726882b45627aec.22185.1712923861000000.zst" Apr 12 14:11:02 thinkpad-x13 systemd[900]: Started Launch DrKonqi for a systemd-coredump crash (PID 22201/UID 0). Apr 12 14:11:02 thinkpad-x13 drkonqi-coredump-launcher[22247]: Unable to find file for pid 22185 expected at "kcrash-metadata/dotnet.53cd566ffe7045288726882b45627aec.22185.ini" Apr 12 14:11:02 thinkpad-x13 drkonqi-coredump-launcher[22247]: Nothing handled the dump :O Apr 12 14:11:02 thinkpad-x13 systemd[1]: drkonqi-coredump-processor@3-22199-0.service: Deactivated successfully.

2 and 3:

$ uname -r
6.8.5-zen1-1-zen
$ ldd --version
ldd (GNU libc) 2.39

4: No, the official build (and the binary from your fork) also segfaults.

I sent you a coredump.

smoogipoo commented 6 months ago

Tracking upstream fix in https://github.com/libsdl-org/SDL/pull/9523

FreezyLemon commented 6 months ago

Fixed by #6240.