Bug 470898 - resource leak: the number of threads increases over time, boundlessly
Summary: resource leak: the number of threads increases over time, boundlessly
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: platform-x11-standalone (show other bugs)
Version: 5.27.5
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL: https://bugs.debian.org/cgi-bin/bugre...
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-11 09:46 UTC by Julien Muchembled
Modified: 2023-08-06 03:45 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
strace output just after kwin_x11 has started (154.13 KB, application/gzip)
2023-06-12 10:23 UTC, Julien Muchembled
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Muchembled 2023-06-11 09:46:38 UTC
SUMMARY

After 17 days, the number of threads of /usr/bin/kwin_x11 process has exceeded 2700 and it keeps increasing. At the beginning of a session, the process starts with 34 threads.

I could find that such leak happens when viewing videos fullscreen e.g. with mpv. More precisely, when exiting fullscreen.

I found the issue because I configure a nproc limit to protect against fork-bombs.

STEPS TO REPRODUCE
1. start mpv without --fs -> thread count does not change
2. switch to fullscreen -> usually -2 threads
3. leaves fullscreen -> usually +17 threads
4. exit mpv -> thread count does not change

ADDITIONAL INFORMATION

- Version 4:5.27.2 was affected too. I previously used 4:5.24.4 and I'm almost sure it had no leak or it was not as severe.
- I do have a 4k intel display.
- I was unable to reproduce the issue inside qemu (didn't try 4k though, only FHD).
- I found that the number of threads (initially & how fast it increases) depends on the number of CPU. I have a i7-1260P (16 entries in /proc/cpuinfo).
- kwin_wayland is not affected. And wayland also fixes display corruption I had with X11 (regularly, for less than 1s).
Comment 1 David Edmundson 2023-06-11 20:21:58 UTC
How did you see how many threads were being used?

Could you reproduce this with firefox going fullscreen and back?
Comment 2 Julien Muchembled 2023-06-12 10:22:47 UTC
(In reply to David Edmundson from comment #1)
> How did you see how many threads were being used?

With `ls |wc -l` within the `/proc/<pid>/task/` folder of kwin_x11 process.

> Could you reproduce this with firefox going fullscreen and back?

No issue with Firefox. I even tried a youtube video.

BTW, I only mentioned mpv as an example but there's also vlc.

To get more information, I can try patches against 4.27.5 if you have any.
Comment 3 Julien Muchembled 2023-06-12 10:23:51 UTC
Created attachment 159609 [details]
strace output just after kwin_x11 has started

During the capture, I used mpv and went/left fullscreen twice. If I look at correctly, leaked threads are stuck at a futex syscall so it may not be useful.
Comment 4 Bug Janitor Service 2023-06-27 03:45:15 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 5 Fushan Wen 2023-07-07 15:51:11 UTC
Cannot reproduce
Comment 6 Bug Janitor Service 2023-07-22 03:45:03 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 7 Bug Janitor Service 2023-08-06 03:45:07 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!