Bug 1696961

Summary: Plasmashell eats up open file descriptors on X server until maximum reached
Product: [Fedora] Fedora Reporter: Juha Nikkanen <nikkej>
Component: plasma-workspaceAssignee: KDE SIG <kde-sig>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 29CC: jgrulich, kde-sig, me, rdieter, than
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-01 08:25:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
dmesg-5.0.5-200.fc29.x86_64
none
lspci-v none

Description Juha Nikkanen 2019-04-06 16:37:32 UTC
Created attachment 1552941 [details]
dmesg-5.0.5-200.fc29.x86_64

Description of problem:
After longish use of KDE Plasma session, Xorg server runs out of an anonymous file handles (a count of 1024 by default). I.e. /proc/`pidof Xorg`/fd fills up entries like:
...
lrwx------. 1 root root 64 Apr  6 10:55 95 -> '/memfd:xshmfence (deleted)'
lrwx------. 1 root root 64 Apr  6 13:18 96 -> '/memfd:xshmfence (deleted)'
lrwx------. 1 root root 64 Apr  6 10:55 97 -> '/memfd:xshmfence (deleted)'
lrwx------. 1 root root 64 Apr  6 10:55 98 -> '/memfd:xshmfence (deleted)'
lrwx------. 1 root root 64 Apr  6 10:55 99 -> '/memfd:xshmfence (deleted)'
...
And when Xorg has run out of system file limit, random problems start to appear:
- key bindings may lost and/or have no desired effect
- mouse clicks / drags have no effect
- $HOME/.cache corrupts somehow

Version-Release number of selected component(s):
kernel-5.0.5-200.fc29.x86_64
xorg-x11-drv-amdgpu 19.0.0
plasma-workspace 5.14.5
mesa 18.3.5

How reproducible:
always

Steps to Reproduce:
1. login to Plasma session
2. open dozens of appications so that Task Manager starts grouping task instances
3. observe content of /proc/`pidof Xorg`/fd by commands ls and wc
4. induce creation of memfd:xshmfence fds by hovering on panel (Task Manager), over group of open tasks so that Task Manager shows thumbnails of windows of open applications. This step will increase fds by number of window thumbnails of hovered group
5. repeat from 3. until system file limit is hit

Actual results:
see above

Expected results:
plasmashell shall release rendering related memory stuff right after use

Additional info:
Hovering on Pager or on System Tray in a such way that popup window appears does not consume an anonymous file handles on X server permanently. Only via Task Manager does.

Comment 1 Juha Nikkanen 2019-04-06 16:38:48 UTC
Created attachment 1552942 [details]
lspci-v

Comment 2 Rex Dieter 2019-04-06 21:40:28 UTC
I encourage you to report this upstream at bugs.kde.org, particularly if you have an easy way to reproduce it.

Comment 3 Juha Nikkanen 2019-04-07 15:43:29 UTC
Rex,

thanks for the suggestion. I reported and slightly edited to add clarifications here and there:
https://bugs.kde.org/show_bug.cgi?id=406303

Comment 4 Juha Nikkanen 2019-06-01 08:25:41 UTC
Plasma update 5.57.0-2.fc29 fixed this issue, it contains patch:
https://phabricator.kde.org/D20805