Bug 478831 - Plasmashell runs out of file descriptors when emacs visits lots of files
Summary: Plasmashell runs out of file descriptors when emacs visits lots of files
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: general (show other bugs)
Version: 5.27.8
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-21 11:51 UTC by Göran Uddeborg
Modified: 2024-01-12 16:08 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0


Attachments
Strace from plasmashell started shortly before the problem (91.04 KB, application/x-xz)
2023-12-21 11:51 UTC, Göran Uddeborg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Göran Uddeborg 2023-12-21 11:51:31 UTC
Created attachment 164340 [details]
Strace from plasmashell started shortly before the problem

SUMMARY
When I run an elisp program in my emacs, it very often results in the desktop panel disappearing and the background goes black. It lasts for a couple of seconds and then the panel and background reappears. The emacs program finishes successfully and does not seem to be affected. In the journal there are those messages from plasmashell.

dec 21 09:25:42 mimmi plasmashell[425833]: error marshalling arguments for get_icon: dup failed: För många öppna filer
dec 21 09:25:42 mimmi plasmashell[425833]: Error marshalling request: För många öppna filer
dec 21 09:25:42 mimmi plasmashell[425833]: The Wayland connection experienced a fatal error: För många öppna filer
dec 21 09:25:42 mimmi systemd[416625]: plasma-plasmashell.service: Main process exited, code=exited, status=1/FAILURE

"För många öppna filer" is Swedish for "Too many open files"

STEPS TO REPRODUCE
Running my emacs program as described above, but it somehow is dependent on my environment. I've not been able to create an independent reproducer.

OBSERVED RESULT
Plasmashell exits with a failure. Systemd then starts a new instance, so the desktop recovers.

EXPECTED RESULT
I don't understand why this affects plasmashell at all.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.11
Fedora 39

ADDITIONAL INFORMATION
This has happened for a while, it did not appear in any specific version.

The emacs program does a "grep" over files in my home directory and then emacs visits the file positions listed by the "grep" command. The command typically finds entries in up to 50 files, and the total number of hits could be in the range of hundreds. The risk of triggering the problem seems to increase with more matches, but it is hard to say exactly. As mentioned, I have tried to reproduce with a set of test files in a simple environment, but been unable to trigger it.

I started debugging by attatching an "strace" to plasmashell before running my emacs function, and have a trace from where the problem is triggered. I note that plasmashell is opening /sys/devices/system/cpu/online and creates pipes over and over again, until it runs out of file descriptors. I attach the trace hoping it might be of some help.
Comment 1 Fushan Wen 2024-01-11 02:00:52 UTC
Git commit 572aafa6eead5d1a56dfc5eefaccd7c76fb40a61 by Fushan Wen, on behalf of Moody Liu.
Committed on 11/01/2024 at 03:00.
Pushed by fusionfuture into branch 'master'.

libtaskmanager: do not leak fd when reading icons in waylandtaskmodel
FIXED-IN: 6.0

M  +3    -0    libtaskmanager/waylandtasksmodel.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/572aafa6eead5d1a56dfc5eefaccd7c76fb40a61
Comment 2 Fushan Wen 2024-01-11 02:12:00 UTC
Git commit 3ffc85aedc606f0d3c328a5190cd829751c97a48 by Fushan Wen, on behalf of Moody Liu.
Committed on 11/01/2024 at 03:01.
Pushed by fusionfuture into branch 'Plasma/6.0'.

libtaskmanager: do not leak fd when reading icons in waylandtaskmodel
FIXED-IN: 6.0


(cherry picked from commit 572aafa6eead5d1a56dfc5eefaccd7c76fb40a61)

M  +3    -0    libtaskmanager/waylandtasksmodel.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/3ffc85aedc606f0d3c328a5190cd829751c97a48
Comment 3 Bug Janitor Service 2024-01-11 09:06:17 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3761
Comment 4 Fushan Wen 2024-01-12 02:45:29 UTC
Git commit 044763af6ccbb70847265743dc3c8b17a2b38ec6 by Fushan Wen.
Committed on 12/01/2024 at 02:04.
Pushed by fusionfuture into branch 'master'.

libtaskmanager: add test for bug 478831

A  +37   -0    libtaskmanager/autotests/data/windows/bug478831.py
M  +47   -0    libtaskmanager/autotests/waylandtasksmodeltest.cpp
M  +1    -2    libtaskmanager/autotests/waylandtasksmodeltestwrapper.py

https://invent.kde.org/plasma/plasma-workspace/-/commit/044763af6ccbb70847265743dc3c8b17a2b38ec6
Comment 5 Bug Janitor Service 2024-01-12 15:51:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/3763
Comment 6 Fushan Wen 2024-01-12 16:08:16 UTC
Git commit 3922326aa55926d29b73453e90919f07105dbaaf by Fushan Wen.
Committed on 12/01/2024 at 16:51.
Pushed by fusionfuture into branch 'Plasma/6.0'.

libtaskmanager: add test for bug 478831


(cherry picked from commit 044763af6ccbb70847265743dc3c8b17a2b38ec6)

A  +37   -0    libtaskmanager/autotests/data/windows/bug478831.py
M  +47   -0    libtaskmanager/autotests/waylandtasksmodeltest.cpp
M  +1    -2    libtaskmanager/autotests/waylandtasksmodeltestwrapper.py

https://invent.kde.org/plasma/plasma-workspace/-/commit/3922326aa55926d29b73453e90919f07105dbaaf