Bug 462267 - KWin tabbox should not make the X server leak "/memfd:xshmfence" filedescriptors until the X server becomes unusable due to exhausted filedescriptors.
Summary: KWin tabbox should not make the X server leak "/memfd:xshmfence" filedescript...
Status: REPORTED
Alias: None
Product: kwin
Classification: Plasma
Component: tabbox (show other bugs)
Version: 5.26.3
Platform: openSUSE Linux
: NOR major
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-26 13:33 UTC by Felix
Modified: 2022-11-30 19:33 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 Felix 2022-11-26 13:33:48 UTC
SUMMARY
Each showing of the task switcher window makes the X server leak resources, overloading it over time.

STEPS TO REPRODUCE
1. Run KWin on X11 on Linux.
2. Observe the number of open filedescriptors of the X server which refer to "/memfd:xshmfence", e.g. using "ls -la /proc/"$(pidof X)"/fd | grep "/memfd:xshmfence" | wc -l". Note this number. For example, the number is 157.
3. Hold the left "alt" key. Press and release the "tab" key. Wait until the task switcher window (it does not matter which style of task switcher window you have configured, the problem seems to appear for any task switcher window style). Then release the left "alt" key.
4. Observe the number of open filedescriptors of the X server which refer to "/memfd:xshmfence" again, e.g. using "ls -la /proc/"$(pidof X)"/fd | grep "/memfd:xshmfence" | wc -l". Note this number, too.
5. Repeat step 3.
6. Repeat step 4.

OBSERVED RESULT
It can be observed that the number of "xshmfence"-filedescriptors increased each time the task switcher window was shown.
The observed increase in the number of filedescriptors is sometimes by +1, sometimes by +2 per task switcher window show.
If sufficiently many shows of task switcher windows happen, then the limited number of filedescriptors of the X server process (usually 1024) is exhausted. After that, the KDE desktop becomes completely unusable and a restart of the X server becomes necessary, loosing all the current open work. Depending on user behavior, this may take some hours or days to happen. It may never happen for users who do not use the task switcher. It does not happen if the user is always fast enough when using the Alt+Tab shortcut such that the task switcher window is never shown.

EXPECTED RESULT
It is expected that the number of "xshmfence"-filedescriptors does not increase each time the task switcher window is shown.
If sufficiently many task switcher windows are shown, the limited number of filedescriptors of the X server process (usually 1024) should not be exhausted.  The KDE desktop should not become completely unusable. A restart of the X server should not become necessary.

SOFTWARE/OS VERSIONS
Linux Kernel: 6.0.9
KDE Plasma Version: 5.26.3
KDE Frameworks Version: 5.100.1
Qt Version: 5.15.7

ADDITIONAL INFORMATION
The bug https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1018176 is probably the same.
Bug 443990 may be related.
This bug exists despite the fix to bug 406303.