hyprwm / aquamarine

Aquamarine is a very light linux rendering backend library
BSD 3-Clause "New" or "Revised" License
252 stars 20 forks source link

Segfault after creating the gbm allocator #88

Open a-usr opened 3 weeks ago

a-usr commented 3 weeks ago

Already reported ? *

Regression?

Yes

System Info and Version

System/Version info ```sh Hyprland, built from branch at commit 9a09eac79b85c846e3a865a9078a3f8ff65a9259 (). Date: 2024-08-07 Tag: , commits: 9a09eac79b85c846e3a865a9078a3f8ff65a9259 flags: (if any) System Information: System name: Linux Node name: silenos Release: 6.6.52 Version: hyprwm/Hyprland#1-NixOS SMP PREEMPT_DYNAMIC Wed Sep 18 17:24:10 UTC 2024 GPU information: 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA106 [GeForce RTX 3060 Lite Hash Rate] [10de:2504] (rev a1) (prog-if 00 [VGA controller]) NVRM version: NVIDIA UNIX x86_64 Kernel Module 560.35.03 Fri Aug 16 21:39:15 UTC 2024 os-release: ANSI_COLOR="1;34" BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" BUILD_ID="24.05.20240918.dbebdd6" DOCUMENTATION_URL="https://nixos.org/learn.html" HOME_URL="https://nixos.org/" ID=nixos IMAGE_ID="" IMAGE_VERSION="" LOGO="nix-snowflake" NAME=NixOS PRETTY_NAME="NixOS 24.05 (Uakari)" SUPPORT_END="2024-12-31" SUPPORT_URL="https://nixos.org/community.html" VERSION="24.05 (Uakari)" VERSION_CODENAME=uakari VERSION_ID="24.05" plugins: hy3 by outfoxxed ver 0.1 ======Config-Start====== Config File: /home/usr/.config/hypr/hyprland.conf: Read Succeeded exec-once = /nix/store/0hm8vh65m378439kl16xv0p6l7c51asj-dbus-1.14.10/bin/dbus-update-activation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURRENT_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target plugin=/nix/store/zrmjhsp2p03p0yb23p7qgn3hfyf4xfp4-hy3-hl0.42.0/lib/libhy3.so $mod=SUPER animations { bezier=myBezier, 0.05, 0.9, 0.1, 1.05 animation=windows, 1, 5, myBezier animation=windowsOut, 1, 5, default, popin 80% animation=border, 1, 5, default animation=borderangle, 1, 8, default animation=fade, 1, 7, default animation=workspaces, 1, 6, default animation=specialWorkspace, 1, 3, default, slidevert } cursor { no_hardware_cursors=false } debug { disable_logs=false } decoration { blur { enabled=true passes=1 size=5 vibrancy=0.169600 } rounding=5 } general { layout=hy3 } input { kb_layout=de } render { explicit_sync=true explicit_sync_kms=true } bind=$mod SHIFT, Left, hy3:movewindow, l bind=$mod SHIFT, Right, hy3:movewindow, r bind=$mod SHIFT, Up, hy3:movewindow, u bind=$mod SHIFT, Down, hy3:movewindow, d bind=$mod, Left, hy3:movefocus, l bind=$mod, Right, hy3:movefocus, r bind=$mod, Up, hy3:movefocus, u bind=$mod, Down, hy3:movefocus, d bind=$mod, X, hy3:makegroup, h bind=$mod SHIFT, X, hy3:makegroup, v bind=$mod, escape, exec, ags --toggle-window powermenu bind=$mod, F, exec, chromium bind=, Print, exec, grimblast copy area bind=$mod, M, exit bind=$mod, T, exec, foot bind=$mod, Q, killactive bind=$mod, L, exec, hyprlock bind=ALT, space, exec, ags --toggle-window launcher bind=$mod SHIFT, S, exec, grim -g "$(slurp)" - | tee >(wl-copy) >(swappy -f -) bind=SUPER_SHIFT, C, exec, cliphist list | wofi --show=dmenu | cliphist decode | wl-copy bind=$mod, 1, workspace, 1 bind=$mod SHIFT, 1, movetoworkspace, 1 bind=$mod, 2, workspace, 2 bind=$mod SHIFT, 2, movetoworkspace, 2 bind=$mod, 3, workspace, 3 bind=$mod SHIFT, 3, movetoworkspace, 3 bind=$mod, 4, workspace, 4 bind=$mod SHIFT, 4, movetoworkspace, 4 bind=$mod, 5, workspace, 5 bind=$mod SHIFT, 5, movetoworkspace, 5 bind=$mod, 6, workspace, 6 bind=$mod SHIFT, 6, movetoworkspace, 6 bind=$mod, 7, workspace, 7 bind=$mod SHIFT, 7, movetoworkspace, 7 bind=$mod, 8, workspace, 8 bind=$mod SHIFT, 8, movetoworkspace, 8 bind=$mod, 9, workspace, 9 bind=$mod SHIFT, 9, movetoworkspace, 9 bind=$mod, 0, workspace, 10 bind=$mod SHIFT, 0, movetoworkspace, 10 bind=, F1, togglespecialworkspace, E bindi=, code:122, exec, pamixer -d 5 bindi=, code:123, exec, pamixer -i 5 bindi=, code:173, exec, playerctl previous bindi=, code:171, exec, playerctl next bindi=, code:172, exec, playerctl play-pause bindm=$mod, mouse:274, movewindow bindm=$mod, mouse:272, resizewindow env=XDG_CACHE_DIR,/home/usr/.cache/ env=XDG_CONFIG_HOME,/home/usr/.config/ env=ELECTRON_OZONE_PLATFORM_HINT,auto env=NIXOS_OZONE_WL,1 exec-once=hyprpaper exec-once=wl-paste --type text --watch cliphist store exec-once=wl-paste --type image --watch cliphist store exec-once=ags monitor=Unknown-1, disable windowrule=fullscreen, title:(HELLDIVERS™ 2) windowrule=fullscreen, title:(Titanfall 2) windowrulev2=workspace special:E silent, class:(vesktop) ======Config-End======== ```

Description

On startup, Upstream (58669fef) hyprland pretty much immediately crashes with sigabrt. Looking at the crash report this happens just after hyprland reports having sucessfully created the gbm allocator (I kinda doubt it was actually sucessful but whatever) (see attached report). This is also reproducible with a empty config:

touch empty.conf
Hyprland -c empty.conf

I tried to bisect, but hyprland just refused to build on a local clone. Entering the nix shell with or without nixpkgs overriden to the system version yielded the following:

error: builder for '/nix/store/7c31lsnk2jrfcyzq0h6x8vbpywib6pcg-hyprland-0.43.0+date=2024-09-18_dirty.drv' failed with exit code 1;
       last 10 log lines:
       > Run-time dependency xcb-errors found: YES 1.0.1
       > Run-time dependency xcb-icccm found: YES 0.4.2
       > Run-time dependency xcb-render found: YES 1.17.0
       > Run-time dependency xcb-res found: YES 1.17.0
       > Run-time dependency xcb-xfixes found: YES 1.17.0
       > Run-time dependency gio-2.0 found: YES 2.80.4
       >
       > meson.build:44:13: ERROR: Subproject exists but has no CMakeLists.txt file.
       >
       > A full log can be found at /build/source/build/meson-logs/meson-log.txt
       For full logs, run 'nix log /nix/store/7c31lsnk2jrfcyzq0h6x8vbpywib6pcg-hyprland-0.43.0+date=2024-09-18_dirty.drv'.

(@fufexan This is probably your area, help would be appreciated)

How to reproduce

  1. Start Hyprland
  2. Find satisfaction in the screen going black for about 2ms
  3. Profit

Crash reports, logs, images, videos

funky_report.txt

a-usr commented 3 weeks ago

I just tested on latest release, and it also occurs there :+1:

vaxerski commented 3 weeks ago

das da wong repo

a-usr commented 2 weeks ago

Mb

a-usr commented 2 weeks ago

I got bisect to work. The first bad commit is https://github.com/hyprwm/Hyprland/commit/5b1375141bd77c26023fb4a8dc087272be82849a

which updated AQ from cff00196f0fcf734a2bf164eb0dfdb6e58c5c906 to f8a687dd29ff019657498f1bd14da2fbbf0e604b

a-usr commented 2 weeks ago

It would appear that the first bad Aquamarine commit is b9ab839ab3c. Im not sure how much sense this makes.

a-usr commented 2 weeks ago

Nevermind, something else is the issue

a-usr commented 2 weeks ago

Wouldve been very weird if 3 lines of added code where the issue

a-usr commented 2 weeks ago

After manually modifying the flake.lock I have the numb feeling that the culprit is wayland-scanner

reidlabwastaken commented 1 week ago

i have this issue too

system information: https://0x0.st/XERx.txt crash report: https://0x0.st/XERw.txt

a-usr commented 1 week ago

i have this issue too

Can you reproduce that the first bad commit I bisected crashes, and the one before works just fine?

jakubkaczor commented 1 week ago

@a-usr I assume that you tested each Aquamarine version by substituting URL in Hyprland's Flake and building Hyprland from source. If so, on which version of Hyprland did you do all the testing? 0.43.0?

a-usr commented 1 week ago

@a-usr I assume that you tested each Aquamarine version by substituting URL in Hyprland's Flake and building Hyprland from source. If so, on which version of Hyprland did you do all the testing? 0.43.0?

https://github.com/hyprwm/aquamarine/issues/88#issuecomment-2383743848

Assuming that we actually have the same issue, the commit prior to the first bad one I mentioned in my message (So https://github.com/hyprwm/Hyprland/commit/4af9410dc2d0e241276a0797d3f3d276310d956e) should build and run perfectly fine for you, since it also did for me

reidlabwastaken commented 1 week ago

i have this issue too

Can you reproduce that the first bad commit I bisected crashes, and the one before works just fine?

sure! i can't actually do that right now because i have school for the next 8 hours but i'll start bisecting afterwards

jakubkaczor commented 1 week ago

Hmm, for me, also https://github.com/hyprwm/Hyprland/commit/4af9410dc2d0e241276a0797d3f3d276310d956e crashes. I attached the crash report, but it looks similar. hyprlandCrashReport116305.txt

jakubkaczor commented 1 week ago

I have done a Git bisection between v0.41.2 (good) and v0.42.0 (bad), and the first bad commit was https://github.com/hyprwm/Hyprland/commit/016da234d0e852de3ef20eb2e89ac58d2a85f6e7. I attach the stdout+stderr of Hyprland and the crash report.


crash-report.txt stdoutanderr.txt

a-usr commented 1 week ago

Thats a completely different error, It says it couldnt create the backend. Thats a fatal error, thus the crash. @vaxerski is Intel supported / did any issues between aq and intel igpus come up which have been fixed? Or is this a new one? In any case jakub's problem deserves its own issue judging by the fact that the error in jakub's closed issue is different thats probably been fixed @jakubkaczor try searching for a different kind of crash instead. are the crash reports between the good and bad commit I bisected different?

reidlabwastaken commented 1 week ago

ah! horrid! when using an older commit, i now get the same error that @jakubkaczor is getting

Bestest-Coder commented 1 week ago

I think I might be having the same or a related issue, or I at least can't find anything similar on the issue trackers so far. While on NixOS starting Hyprland gets me a SEGV on both 0.43 and 0.44, with the last things in the log being Wayland backend count not start and created a GBM allocator

Crash Report: hyprlandCrashReport1625.txt

reidlabwastaken commented 1 week ago

updating my mesa fixed this issue for me!!!

Bestest-Coder commented 1 week ago

updating to what version?

jakubkaczor commented 1 week ago

Thats a completely different error, It says it couldnt create the backend. Thats a fatal error, thus the crash. ~@vaxerski is Intel supported / did any issues between aq and intel igpus come up which have been fixed? Or is this a new one? In any case jakub's problem deserves its own issue~ judging by the fact that the error in jakub's closed issue is different thats probably been fixed

Sure, I suspected they may be different. I am convinced there are multiple “zeros” with different causes on the bisected interval. My previous, closed issue[^1] was reported with the v0.44.0 crash report. I didn't manage to make a bisection back then, but since I finally did, I report all the results here.

@jakubkaczor try searching for a different kind of crash instead. are the crash reports between the good and bad commit I bisected different?

Your good (4af9410d) and bad (5b137514) indeed give different results than my bad (016da23). I have already given the report for your good. Furthermore, I attach the crash report for your bad one below.

5b137514-crash-report.log

[^1]: The one considered a duplicate of yours.

a-usr commented 1 week ago

Alright, I personally fixed the issue by migrating from stable nixpkgs to unstable. I am pretty confident that the issue is a version missmatch between hyprland's mesa, and the system mesa.

@jakubkaczor I suspect your mesa installation isnt managed through nix? could you try upgrading you mesa version using pacman and check wether hyprland versions past the first bad commit still crash with mesa mentioned in the stacktrace?

jakubkaczor commented 6 days ago

We have found the solution. This concerns people using Nix or Home Manager on distributions other than NixOS. On such setup, there are additional steps one has to make in order to run an OpenGL program^1. In my opinion, the simplest way to do it is to use nixGL by invoking nixGL <program>. This requires nixGL's nixpkgs input to be of the version compatible with OpenGL/GLIBC used by the program, which can be assured by making both use the same version of nixpkgs^2.

What happened in my case was that I used nixGL using the version of nixpkgs I use by default in my Home Manager Flake, that is, nixpkgs 24.05. I combined it with Hyprland versions using nixpkgs-unstable, what resulted in crashes.

The Arch Linux version of Mesa doesn't appear to be meaningful. I tested after upgrading to 1:24.2.4-1 and after downgrading to 1:24.0.7-3[^3].

Thank you, @a-usr. “I suspect your mesa installation isnt managed through nix?” hinted me to the cause.

[^3]: With pacman -U https://archive.archlinux.org/packages/m/mesa/mesa-1%3A24.0.7-3-x86_64.pkg.tar.zst. From the back trace, it appears Hyprland uses this version.

a-usr commented 6 days ago

Alright, @Bestest-Coder did you fix everything on your end too? Otherwise I'll close this issue, as this isnt even an actual issue with hyprland or aquamarine, but a simple version conflict

Bestest-Coder commented 5 days ago

I have my NixOS system set up through a flake, and change Hyprland versions by simply setting programs.hyprland.package to the nixpkgs-unstable package, would that not itself handle mesa versions? I am also now realizing that I am getting 3 separate readouts for what version I have installed, Hyprland --version, hyprctl version and the link to nix store in /run/current-system/sw/bin/Hyprland also say different things, so maybe I have a bigger issue

jakubkaczor commented 5 days ago

Even on Nix, “OpenGL must break purity due to the need for hardware-specific linkage”^1. I am not sure why this isn't dealt with similarly to system architecture[^2]. Perhaps due to the variability and the size of the set of drivers. Imagine building a package for each graphics card series using different drivers. With things as they are, such pure solution appears impractical.

[^2]: That is, using an analog of the system variable.

a-usr commented 5 days ago

I have my NixOS system set up through a flake, and change Hyprland versions by simply setting programs.hyprland.package to the nixpkgs-unstable package, would that not itself handle mesa versions?

No. Im not sure about the details, but what I can tell you confidently is that the mesa version used by the hyprland derivation and the mesa version used by your system are conflicting with each other. Maybe its some ABI thing, maybe some functions got replaced, but either way they dont work with each other. The only way to solve that is to either change hyprland's mesa version, or your system's. I tried the former already, and that didnt work for some reason (hyprland wouldnt build). So I did the latter and now it works (kind of).

I am also now realizing that I am getting 3 separate readouts for what version I have installed, Hyprland --version, hyprctl version and the link to nix store in /run/current-system/sw/bin/Hyprland also say different things, so maybe I have a bigger issue

You mean you get different commits? thats odd. But hey, as long as it works!

Bestest-Coder commented 2 days ago

Alright turns out I had something weird going on with my greetd that caused it to always use the older version of Hyprland I had installed, so it still doesn't work on anything newer than 41.2. After fixing that, and settings hardware.opengl.package to the mesa from nixpkgs unstable, it doesn't crash in the same spot, but a new one

[CRITICAL] [Tracy GPU Profiling] eglGetProcAddress(eglCreateImageKHR) failed

If this is completely unrelated to the segfault you can close this and I'll create a new issue

a-usr commented 2 days ago

Just curious, can you send the full crash report?

Alright turns out I had something weird going on with my greetd that caused it to always use the older version of Hyprland I had installed, so it still doesn't work on anything newer than 41.2. After fixing that, and settings hardware.opengl.package to the mesa from nixpkgs unstable, it doesn't crash in the same spot, but a new one

[CRITICAL] [Tracy GPU Profiling] eglGetProcAddress(eglCreateImageKHR) failed

If this is completely unrelated to the segfault you can close this and I'll create a new issue

Bestest-Coder commented 2 days ago

Sure, I haven't gotten the chance to look into the new errors coming up and tinker with my config. hyprlandCrashReport154.txt

a-usr commented 2 days ago

Thats rather odd. Did you override the nixpkgs input for hyprland? It seems it cant load / access the opengl lib...

Bestest-Coder commented 2 days ago

Alright turns out I was setting hardware.opengl.package wrong, I had it as unstable.mesa and not unstable.mesa.drivers. I can get 0.44.1 to run now, but I think it's having GPU issues as some programs can't open, most annoyingly my terminal emulator, along with not fully recognizing the extra monitor I have plugged into it.

a-usr commented 2 days ago

Alright turns out I was setting hardware.opengl.package wrong, I had it as unstable.mesa and not unstable.mesa.drivers. I can get 0.44.1 to run now, but I think it's having GPU issues as some programs can't open, most annoyingly my terminal emulator, along with not fully recognizing the extra monitor I have plugged into it.

I recommend you try changing your entire system to use unstable if possible, that might fix your issues