Repository navigation
High CPU Usage & fd leak in xdg-desktop-portal-hyprland #16999
Hyprland versionv0.57.2 Is this a regression?Don't know What's the bug?I believe that this might be a reproduction of hyprwm/xdg-desktop-portal-hyprland#273 I noticed that the CPU temperatures were getting quite high on my linux box and was able to track it down to high CPU usage on xdg-desktop-portal-hyprland: I had Codex dig deeper and it noted that the process had exhausted fds: My Linux box is connected to a monitor that has several other laptops connected to it. I believe that the display is changing inputs regularly, which is causing the display to be added and removed, which generate events in the hyprland desktop portal service, which result in fds leaking. I believe I have this narrowed down the fd leak to the format-table callback implementation, as shown in the vouch and pull request linked below. hyprwm/.github#145 The fd leak seems obvious enough to me, but I wasn't able to determine how running out of fds results in high CPU usage. Reproduction stepsSetup This assumes you are in bash. First, save the portal's pid: We'll set the soft fd limit for the process to 30. I noticed that the service tends to start with around 10-20 fds, so this gives us some room, but you can check the baseline with: Then edit the config: add this to the conf: restart the service: Save the pid again for later: I use the Reproduction To reproduce we'll be creating and destroying virtual displays. Each creation and destroy will leak fds. When we hit the fd limit of 30 and send one more create/destroy, the CPU usage will start climbing and the CPU temps will get heated.
Cleanup Revert overrides and restart the service. AttachmentsI reproduced this on two machines, my 2015 xps13 and on my hp tiny pc. Here are some additional reproduction logs. I acknowledge that:
|
hyprwm/xdg-desktop-portal-hyprland#461