hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.09k stars 882 forks source link

Suspected VRAM Memory Leak when reloading Config #7728

Closed h3xaguard closed 1 month ago

h3xaguard commented 1 month ago

Already reported ? *

Regression?

No

System Info and Version

System/Version info ```sh Hyprland, built from branch at commit 0f594732b063a90d44df8c5d402d658f27471dfe (props: bump version to 0.43.0). Date: Sun Sep 8 16:48:21 2024 Tag: v0.43.0, commits: 5196 flags: (if any) System Information: System name: Linux Node name: terminator Release: 6.10.7-1-cachyos-cachyos-lto Version: #1 SMP PREEMPT_DYNAMIC Mon, 02 Sep 2024 09:06:28 +0000 GPU information: 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA104 [GeForce RTX 3070 Ti] [10de:2482] (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: NAME="Arch Linux" PRETTY_NAME="Arch Linux" ID=arch BUILD_ID=rolling ANSI_COLOR="38;2;23;147;209" HOME_URL="https://archlinux.org/" DOCUMENTATION_URL="https://wiki.archlinux.org/" SUPPORT_URL="https://bbs.archlinux.org/" BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues" PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/" LOGO=archlinux-logo plugins: ======Config-Start====== Config File: /home/luke/.config/hypr/hyprland.conf: Read Succeeded # # Please note not all available settings / options are set here. # For a full list, see the wiki # $monitor1 = DP-3 $monitor2 = HDMI-A-1 # Configure Monitors monitor=$monitor1,2560x1440@165,1080x0,1,bitdepth,10, vrr, 1 monitor=$monitor2,1920x1080@75,0x0,1,bitdepth,10, transform, 3 # Workspaces workspace=1,monitor:$monitor1,default:true workspace=2,monitor:$monitor1 workspace=3,monitor:$monitor1 workspace=4,monitor:$monitor1 workspace=5,monitor:$monitor1 workspace=6,monitor:$monitor2,default:true workspace=7,monitor:$monitor2 workspace=8,monitor:$monitor2 workspace=9,monitor:$monitor2 workspace=10,monitor:$monitor2 workspace=1337,monitor:$monitor1 # Start Shit exec-once = waybar exec-once = hyprpaper exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP exec-once=bluetoothctl connect AC:80:0A:9C:18:45 # connect Sony WH-1000XM4 headphones via Bluetooth # Source a file (multi-file configs) # source = ~/.config/hypr/myColors.conf # Set programs that you use $terminal = kitty $fileManager = thunar $menu = wofi --show drun # Some default env vars. env = XCURSOR_SIZE,24 env = QT_QPA_PLATFORMTHEME,qt5ct # change to qt6ct if you have that # For all categories, see https://wiki.hyprland.org/Configuring/Variables/ input { kb_layout = us kb_variant = kb_model = kb_options = kb_rules = follow_mouse = 1 touchpad { natural_scroll = no } accel_profile = flat sensitivity = 0 # -1.0 to 1.0, 0 means no modification. } general { gaps_in = 5 gaps_out = 10 border_size = 2 col.active_border = rgba(89b4fa80) rgba(a6e3a180) 45deg col.inactive_border = rgba(59595980) # Every other layout is bad layout = dwindle # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on (Why tf would you turn this on) allow_tearing = true } decoration { # See https://wiki.hyprland.org/Configuring/Variables/ for more rounding = 8 blur { enabled = true size = 3 passes = 1 } drop_shadow = yes shadow_range = 10 shadow_render_power = 3 shadow_offset = 1 1 col.shadow = rgba(1a1a1a80) } animations { enabled = yes # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more bezier = myBezier, 0.05, 0.9, 0.1, 1.05 animation = windows, 1, 7, myBezier animation = windowsOut, 1, 7, default, popin 80% animation = border, 1, 10, default animation = borderangle, 1, 8, default animation = fade, 1, 7, default animation = workspaces, 1, 6, default } dwindle { # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below preserve_split = yes # you probably want this } gestures { # See https://wiki.hyprland.org/Configuring/Variables/ for more workspace_swipe = off } misc { # See https://wiki.hyprland.org/Configuring/Variables/ for more force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers vfr = true # Variable Framerate, when nothing is happening on screen lower display frames. } # Example windowrule v1 # windowrule = float, ^(kitty)$ # Example windowrule v2 # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more windowrulev2 = suppressevent maximize, class:.* # You'll probably like this. windowrulev2 = float,class:^(pavucontrol)$ windowrulev2 = float,class:^(nwg-look)$ windowrulev2 = float,class:^(waypaper)$ windowrulev2 = float,class:^(openrgb)$ windowrulev2 = float,class:^(rice-settings)$ # Game Mode Related Window Rules windowrulev2 = immediate, class:^steam_app_\d+$ windowrulev2 = workspace 1337,class:^steam_app_\d+$ workspace = 1337, border:false, rounding:false windowrulev2 = immediate, class:^steam_proton$ windowrulev2 = workspace 1337,class:^steam_proton$ workspace = 1337, border:false, rounding:false # See https://wiki.hyprland.org/Configuring/Keywords/ for more $mainMod = SUPER # Rice Settings (Developed by me) bind = SUPER, grave, exec, rice-settings # Multimedia Keys bindle = , XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.2 @DEFAULT_AUDIO_SINK@ 5%+ bindle = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- bindl = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle bindl = , XF86AudioMicMute, exec, pamixer --default-source -t bind = , XF86AudioPrev, exec, playerctl previous bind = , XF86AudioPlay, exec, playerctl play-pause bind = , XF86AudioPause, exec, playerctl pause bind = , XF86AudioNext, exec, playerctl next bind = $mainMod, RETURN, exec, $terminal bind = $mainMod SHIFT, RETURN, exec, [float] $terminal bind = $mainMod, Q, killactive, bind = $mainMod SHIFT, Q, exit, bind = $mainMod, E, exec, $fileManager bind = $mainMod SHIFT, E, exec, [float] $fileManager bind = $mainMod, TAB, togglefloating, bind = $mainMod, SPACE, exec, $menu bind = $mainMod, P, pseudo, # dwindle bind = $mainMod, V, togglesplit, # dwindle bind = $mainMod, M, fullscreen, 1 bind = $mainMod, F, fullscreen, 0 bind = $mainMod, B, exec, firefox # screenshot bind = $mainMod SHIFT, S, exec, grimshot savecopy area - | wl-copy # Lock Screen bind = $mainMod, L, exec, hyprlock # Game mode bind (temporary) bind = $mainMod SHIFT, G, exec, /home/luke/.config/apexos/scripts/gamemode-fullscreen-optimisations # Enable Tearing bind = $mainMod SHIFT, T, exec, /home/luke/hyprtearing # Lock Window Focus bind = CONTROLSHIFT, L, exec, /home/luke/.config/apexos/scripts/lock-primary-monitor # Move window bind = SUPER SHIFT, h, movewindow, l bind = SUPER SHIFT, l, movewindow, r bind = SUPER SHIFT, k, movewindow, u bind = SUPER SHIFT, j, movewindow, d # Resize window bind = SUPER ALT, h, resizeactive, -160 0 bind = SUPER ALT, l, resizeactive, 160 0 bind = SUPER ALT, k, resizeactive, 0 -160 bind = SUPER ALT, j, resizeactive, 0 160 # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 bind = $mainMod, 2, workspace, 2 bind = $mainMod, 3, workspace, 3 bind = $mainMod, 4, workspace, 4 bind = $mainMod, 5, workspace, 5 bind = $mainMod, 6, workspace, 6 bind = $mainMod, 7, workspace, 7 bind = $mainMod, 8, workspace, 8 bind = $mainMod, 9, workspace, 9 bind = $mainMod, 0, workspace, 10 # Move active window to a workspace with mainMod + SHIFT + [0-9] bind = $mainMod SHIFT, 1, movetoworkspace, 1 bind = $mainMod SHIFT, 2, movetoworkspace, 2 bind = $mainMod SHIFT, 3, movetoworkspace, 3 bind = $mainMod SHIFT, 4, movetoworkspace, 4 bind = $mainMod SHIFT, 5, movetoworkspace, 5 bind = $mainMod SHIFT, 6, movetoworkspace, 6 bind = $mainMod SHIFT, 7, movetoworkspace, 7 bind = $mainMod SHIFT, 8, movetoworkspace, 8 bind = $mainMod SHIFT, 9, movetoworkspace, 9 bind = $mainMod SHIFT, 0, movetoworkspace, 10 # Example special workspace (scratchpad) bind = $mainMod, O, togglespecialworkspace, magic bind = $mainMod SHIFT, O, movetoworkspace, special:magic # Scroll through existing workspaces with mainMod + scroll bind = $mainMod, mouse_down, workspace, e+1 bind = $mainMod, mouse_up, workspace, e-1 # Move/resize windows with mainMod + LMB/RMB and dragging bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow ======Config-End======== ```

Description

It seems as every time I reload the Hyprland config, commandline or not, the VRAM slowly creeps up, until it reaches about 800-1100MB of VRAM then stops going up no matter how many times or how I reload the config. I am using hyprctl reload, however I have attempted to use another reload command with the same result. I have noticed there was a similar issue a while ago, https://github.com/hyprwm/Hyprland/issues/809 This is pretty much exactly my problem.

How to reproduce

Crash reports, logs, images, videos

Nvidia-Smi Screenshot

h3xaguard commented 1 month ago

Upon restarting/logging out of the Hyprland session, the GPU memory is perfectly free again only using ~220MiB. 2024-09-10T17:00:23,895258598+08:00

vaxerski commented 1 month ago

Are you sure it's also present in 0.39.1? If not, can you bisect?

h3xaguard commented 1 month ago

I have an error whilst running make all, here is my output: `❯ git clone --recursive https://github.com/hyprwm/Hyprland Cloning into 'Hyprland'... remote: Enumerating objects: 37807, done. remote: Counting objects: 100% (3599/3599), done. remote: Compressing objects: 100% (788/788), done. remote: Total 37807 (delta 3118), reused 3100 (delta 2810), pack-reused 34208 (from 1) Receiving objects: 100% (37807/37807), 68.43 MiB | 14.06 MiB/s, done. Resolving deltas: 100% (29572/29572), done. Submodule 'subprojects/hyprland-protocols' (https://github.com/hyprwm/hyprland-protocols) registered for path 'subprojects/hyprland-protocols' Submodule 'subprojects/tracy' (https://github.com/wolfpld/tracy) registered for path 'subprojects/tracy' Submodule 'subprojects/udis86' (https://github.com/canihavesomecoffee/udis86) registered for path 'subprojects/udis86' Cloning into '/home/luke/hyprland_patch/Hyprland/subprojects/hyprland-protocols'... remote: Enumerating objects: 136, done.
remote: Counting objects: 100% (48/48), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 136 (delta 31), reused 30 (delta 26), pack-reused 88 (from 1)
Receiving objects: 100% (136/136), 30.74 KiB | 507.00 KiB/s, done. Resolving deltas: 100% (64/64), done. Cloning into '/home/luke/hyprland_patch/Hyprland/subprojects/tracy'... remote: Enumerating objects: 40684, done.
remote: Counting objects: 100% (647/647), done.
remote: Compressing objects: 100% (356/356), done.
remote: Total 40684 (delta 377), reused 527 (delta 290), pack-reused 40037 (from 1)
Receiving objects: 100% (40684/40684), 29.28 MiB | 13.14 MiB/s, done. Resolving deltas: 100% (29073/29073), done. Cloning into '/home/luke/hyprland_patch/Hyprland/subprojects/udis86'... remote: Enumerating objects: 2477, done.
remote: Counting objects: 100% (63/63), done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 2477 (delta 34), reused 46 (delta 20), pack-reused 2414 (from 1)
Receiving objects: 100% (2477/2477), 1.81 MiB | 4.33 MiB/s, done. Resolving deltas: 100% (1503/1503), done. Submodule path 'subprojects/hyprland-protocols': checked out 'e06482e0e611130cd1929f75e8c1cf679e57d161' Submodule path 'subprojects/tracy': checked out '37aff70dfa50cf6307b3fee6074d627dc2929143' Submodule path 'subprojects/udis86': checked out '5336633af70f3917760a6d441ff02d93477b0c86' ❯ cd Hyprland ❯ git bisect start status: waiting for both good and bad commits ❯ git bisect good v0.39.1 status: waiting for bad commit, 1 good commit known ❯ git bisect bad v0.43.0 Bisecting: 367 revisions left to test after this (roughly 9 steps) [2f278dc883f3e4e84fb1d18154132f8f4efe42cf] egl: fixup format modifier lookups with implicit modifiers ❯ make all make clear make[1]: Entering directory '/home/luke/hyprland_patch/Hyprland' rm -rf build rm -f ./protocols/.h ./protocols/.c ./protocols/.cpp ./protocols/.hpp rm -rf ./subprojects/wlroots-hyprland/build make[1]: Leaving directory '/home/luke/hyprland_patch/Hyprland' make release make[1]: Entering directory '/home/luke/hyprland_patch/Hyprland' cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=/usr/local -S . -B ./build -G Ninja Not searching for unused variables given on the command line. CMake Warning (dev) at /usr/share/cmake/Modules/GNUInstallDirs.cmake:253 (message): Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. Please enable at least one language before including GNUInstallDirs. Call Stack (most recent call first): CMakeLists.txt:5 (include) This warning is for project developers. Use -Wno-dev to suppress it.

-- The C compiler identification is GNU 14.2.1 -- The CXX compiler identification is GNU 14.2.1 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Gathering git info -- Found Python3: /usr/bin/python3.12 (found version "3.12.5") found components: Interpreter Building itab.c/itab.h... -- Setting up wlroots -- Found PkgConfig: /usr/bin/pkg-config (found version "2.1.1") -- Found WaylandScanner at /usr/bin/wayland-scanner -- Found wayland-protocols at //usr/share/wayland-protocols -- Configuring Hyprland in Release with CMake -- Checking deps... -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Found OpenGL: /usr/lib/libOpenGL.so found components: GLES3 -- Checking for modules 'xkbcommon;uuid;wayland-server;wayland-client;wayland-cursor;wayland-protocols;cairo;pango;pangocairo;pixman-1;libdrm;libinput;hwdata;libseat;libdisplay-info;libliftoff;libudev;gbm;hyprlang>=0.3.2;hyprcursor>=0.1.7;hyprutils>=0.1.1' -- Found xkbcommon, version 1.7.0 -- Found uuid, version 2.40.2 -- Found wayland-server, version 1.23.0 -- Found wayland-client, version 1.23.0 -- Found wayland-cursor, version 1.23.0 -- Found wayland-protocols, version 1.37 -- Found cairo, version 1.18.2 -- Found pango, version 1.54.0 -- Found pangocairo, version 1.54.0 -- Found pixman-1, version 0.43.4 -- Found libdrm, version 2.4.123 -- Found libinput, version 1.26.2 -- Found hwdata, version 0.387 -- Found libseat, version 0.8.0 -- Found libdisplay-info, version 0.2.0 -- Found libliftoff, version 0.5.0 -- Found libudev, version 256 -- Found gbm, version 24.2.2-arch1.1 -- Found hyprlang, version 0.5.2 -- Found hyprcursor, version 0.1.9 -- Found hyprutils, version 0.2.1 -- Looking for execinfo.h -- Looking for execinfo.h - found -- Configuration supports execinfo -- Looking for backtrace in execinfo -- Looking for backtrace in execinfo - not found -- Looking for sys/timerfd.h -- Looking for sys/timerfd.h - found -- Checking for module 'epoll-shim' -- Package 'epoll-shim', required by 'virtual:world', not found -- XWAYLAND Enabled (NO_XWAYLAND not defined) checking deps... -- Checking for modules 'xcb;xwayland;xcb-util;xcb-render;xcb-xfixes;xcb-icccm;xcb-composite;xcb-res;xcb-ewmh;xcb-errors' -- Found xcb, version 1.17.0 -- Found xwayland, version 24.1.2 -- Found xcb-util, version 0.4.1 -- Found xcb-render, version 1.17.0 -- Found xcb-xfixes, version 1.17.0 -- Found xcb-icccm, version 0.4.2 -- Found xcb-composite, version 1.17.0 -- Found xcb-res, version 1.17.0 -- Found xcb-ewmh, version 0.4.2 -- Found xcb-errors, version 1.0.1 -- SYSTEMD support is requested (NO_SYSTEMD not defined)... -- Setting precompiled headers -- Setting link libraries -- Checking for module 'hyprutils>=0.1.1' -- Found hyprutils, version 0.2.1 -- Checking for modules 'tomlplusplus;hyprutils>=0.1.1' -- Found tomlplusplus, version 3.4.0 -- Found hyprutils, version 0.2.1 -- Configuring done (1.4s) -- Generating done (0.0s) -- Build files have been written to: /home/luke/hyprland_patch/Hyprland/build cmake --build ./build --config Release --target all [0/2] Re-checking globbed directories... [50/252] Performing configure step for 'wlroots-hyprland' FAILED: /home/luke/hyprland_patch/Hyprland/subprojects/wlroots-hyprland/src/wlroots-hyprland-stamp/wlroots-hyprland-configure cd /home/luke/hyprland_patch/Hyprland/subprojects/wlroots-hyprland && meson setup --reconfigure build --buildtype=release -Dwerror=false -Dxwayland=enabled -Dexamples=false -Drenderers=gles2 -Dbackends=drm,libinput -Db_sanitize=none && /usr/bin/cmake -E touch /home/luke/hyprland_patch/Hyprland/subprojects/wlroots-hyprland/src/wlroots-hyprland-stamp/wlroots-hyprland-configure

ERROR: Neither source directory 'build' nor build directory None contain a build file meson.build. [57/252] Building CXX object hyprctl/CMakeFiles/hyprctl.dir/main.cpp.o ninja: build stopped: subcommand failed. make[1]: [Makefile:15: release] Error 1 make[1]: Leaving directory '/home/luke/hyprland_patch/Hyprland' make: [Makefile:34: all] Error 2`

h3xaguard commented 1 month ago

And the issue is not present in 0.39.1, what would be the suspect in that case?

vaxerski commented 1 month ago

no clue, gotta bisect.

h3xaguard commented 1 month ago
cmake --build ./build --config Release --target all
[0/2] Re-checking globbed directories...
[50/252] Performing configure step for 'wlroots-hyprland'
FAILED: /home/luke/hyprland_patch/Hyprland/subprojects/wlroots-hyprland/src/wlroots-hyprland-stamp/wlroots-hyprland-configure
cd /home/luke/hyprland_patch/Hyprland/subprojects/wlroots-hyprland && meson setup --reconfigure build --buildtype=release -Dwerror=false -Dxwayland=enabled -Dexamples=false -Drenderers=gles2 -Dbackends=drm,libinput -Db_sanitize=none && /usr/bin/cmake -E touch /home/luke/hyprland_patch/Hyprland/subprojects/wlroots-hyprland/src/wlroots-hyprland-stamp/wlroots-hyprland-configure

ERROR: Neither source directory 'build' nor build directory None contain a build file meson.build.
[57/252] Building CXX object hyprctl/CMakeFiles/hyprctl.dir/main.cpp.o
ninja: build stopped: subcommand failed.
make[1]: *** [Makefile:15: release] Error 1
make[1]: Leaving directory '/home/luke/hyprland_patch/Hyprland'
make: *** [Makefile:34: all] Error 2`

I have done bisect, but upon running make all to compile it, this is the error I receive.

h3xaguard commented 1 month ago

Worked after git bisect skip

❯ git bisect skip
Bisecting: 367 revisions left to test after this (roughly 9 steps)
warning: unable to rmdir 'subprojects/wlroots-hyprland': Directory not empty
[c8873b958dd9330c364339ac4ab58e32b27d82b4] internal: fix fullscreen typos (#7134)
h3xaguard commented 1 month ago

It seems as the problem falls within this commit: renderer: fixup nvidia driver version checks

h3xaguard commented 1 month ago

I can confirm the bad commit is renderer: fixup nvidia driver version checks.

h3xaguard commented 1 month ago

After cloning from the main branch, with the latest updates, just changing static int driverMajor = 0; to int driverMajor = 0; in render/Renderer.cpp, the problem is completely gone. No clue why a static int vs normal int would cause this problem to occur.

vaxerski commented 1 month ago

why not just force disable explicit_sync_kms instead of that (wrong) patch?

IMO seems like an nvidia issue

h3xaguard commented 1 month ago

I suppose I can do that, what does my patch do that makes it wrong? How can changing the int var type disable explicit sync? Genuinely asking. Not surprised if it is an Nvidia issue lol considering many people are having similar issues

vaxerski commented 1 month ago

you made it non static and explicit sync kms is disabled on nvidia below 560 on auto (default)

ferrreo commented 1 month ago

Just running nvidia-smi in a tty with no display server running shows an increase in vram usage every time it is run, this is not a Hyprland issue but a wider driver leak with anything that uses KMS. You might want to disable KMS for 560 for now on auto @vaxerski until Nvidia sort their shit.

vaxerski commented 1 month ago

closing then as nvidia