Bug 462776 - [REGRESSION] X11 file descriptors leak upon showing a notification until maximum reached
Summary: [REGRESSION] X11 file descriptors leak upon showing a notification until maxi...
Status: RESOLVED UPSTREAM
Alias: None
Product: plasmashell
Classification: Plasma
Component: Notifications (show other bugs)
Version: 5.26.3
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-08 11:02 UTC by Konstantin Kharlamov
Modified: 2022-12-08 12:19 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kharlamov 2022-12-08 11:02:49 UTC
SUMMARY

This bug appeared after some update. Basically, Xorg have a bunch of these "/memfd:xshmfence (deleted)" fds, and their number keeps increasing over time, until no more graphical apps are able to start (there's a limit of 1024 file descriptors per process AFAIK). Restarting `plasmashell` resets their number.

I've also seen other glitches, such as plasmashell hanging completely, or picom suddenly not showing a surface — but now that I found the problem with FDs, I suspect that may cause other ones as well.

It's hard to pinpoint the version where it's appeared, mainly because I only yesterday figured out the problem with descriptors, and then upgraded. I know for sure the problem is present since 5.26.3, so I set this version for now.

STEPS TO REPRODUCE
1. Log into a Xorg plasma session
2. Execute `sudo ls /proc/$(pgrep Xorg)/fd | wc -l`
3. Execute `notify-send hello` and wait for notification to disappear
4. Execute `sudo ls /proc/$(pgrep Xorg)/fd | wc -l`

OBSERVED RESULT

The number in step 4 is larger than one in step 2

EXPECTED RESULT

The numbers in step 4 and 2 are the same

WORKAROUND:

Restarting plasmashell resets the number of FDs back:

    killall plasmashell && kstart5 plasmashell &>/dev/null &

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Archlinux
KDE Plasma Version: 5.26.4
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Comment 1 David Edmundson 2022-12-08 11:40:41 UTC
Potentially https://gitlab.freedesktop.org/mesa/mesa/-/issues/7674
Comment 2 Konstantin Kharlamov 2022-12-08 11:47:10 UTC
(In reply to David Edmundson from comment #1)
> Potentially https://gitlab.freedesktop.org/mesa/mesa/-/issues/7674

Nope, not it. The bug says it's not present in 22.1, so I downgraded mesa package to 22.2.1-1 and restarted plasmashell. The problem is still reproducible. I also don't use kwin_x11, I have i3 + picom instead, so there's that as well.
Comment 3 Konstantin Kharlamov 2022-12-08 11:49:14 UTC
Omg, wait, sorry, I mistyped the version. I tested 22.1.1-2, and it fixes the issue. So yeah, it's probably the Mesa problem
Comment 4 Konstantin Kharlamov 2022-12-08 12:19:58 UTC
So, I confirm that upgrading to Mesa 22.3.0-6 fixes the issue. Thank you very much!

(I don't see a "nor our bug" status, not sure if "upstream" is an appropriate one, please change if you deem necessary)