Bug#1037268: kwin-x11: resource leak: the number of threads increases over time, boundlessly

2023-06-11 Thread Julien Muchembled

Control: forwarded -1 https://bugs.kde.org/show_bug.cgi?id=470898

I added more information upstream.

Le 10/06/2023 à 20:22, Nicholas D Steeves a écrit :

I could find that such leak happens when viewing videos fullscreen e.g. with 
mpv. Can anyone reproduce it ? More precisely:
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


I was able to reproduce (with mpv 0.35.1-4), but going fullscreen didn't
increase the kwin thread count on my system; however, exiting fullscreen
consistently increased kwin's thread count by exactly two threads each
time mpv leaves fullscreen.


That's actually what I wrote.


The good news is that one doesn't need to restart KDE.  Try this:

   kwin --replace&


Oh thanks!

But I finally decided to switch to Wayland, and now new issues :(


Version 4:5.27.2-2 was affected too. I previously had 4:5.24.4-1 and I'm almost 
sure it had no leak.


That's not a terrible range to bisect, if it comes to that.


Really? I first checked my setup by successfully building kwin 4:5.27.5-3 and 
then tried 4:5.26.5-1 from from snapshot.debian.org:
- without downgrading any build-depends (and without forcing -d), compilation 
error;
- the executable inside the binary package depends on libraries that aren't 
there anymore.
I gave up.


- I use mpv from deb-multimedia.


For reference, please note that bugs must be reproducible with Debian
alone, otherwise they may be marked invalid.


Sure.


- mpv conf: vo = gpu


Actually, there's also a leak with --vo=x11

Julien



Bug#1037268: kwin-x11: resource leak: the number of threads increases over time, boundlessly

2023-06-10 Thread Nicholas D Steeves
Control: tag -1 confirmed

Julien Muchembled  writes:

> 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.

Interesting!  Mine starts with only 11 threads.  I wonder if this is
hardware dependent?

> I could find that such leak happens when viewing videos fullscreen e.g. with 
> mpv. Can anyone reproduce it ? More precisely:
> 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

I was able to reproduce (with mpv 0.35.1-4), but going fullscreen didn't
increase the kwin thread count on my system; however, exiting fullscreen
consistently increased kwin's thread count by exactly two threads each
time mpv leaves fullscreen.  I would say "I'm horrified too!" but
couldn't this be a new feature that is designed to limit media
consumption? ;)

> Such a leak is at least a severe issue for anyone like me who set a nproc 
> limit to protect against fork-bombs, in particular because it causes 
> mysterious process crashes. I only understood the problem when I wanted to 
> build a software that spawned a lot of processes. It also makes nproc 
> limiting quite unusable without restarting KDE from time to time.

The good news is that one doesn't need to restart KDE.  Try this:

  kwin --replace&

> Version 4:5.27.2-2 was affected too. I previously had 4:5.24.4-1 and I'm 
> almost sure it had no leak.

That's not a terrible range to bisect, if it comes to that.

> A few notes that may be specific to my setup:
> - I do have a 4k intel display. And regularly, for less than 1s, the
> display is corrupted. I haven't tried Wayland yet and I hope it will
> fix it.

Oh, maybe this is why yours has more threads than mine?  Maybe it's
resolution dependent?  (I'm not familiar with kwin's source)

> - I use mpv from deb-multimedia.

For reference, please note that bugs must be reproducible with Debian
alone, otherwise they may be marked invalid.

> - mpv conf: vo = gpu

Here is the config I confirmed with:

  hwdec=vaapi
  vo=gpu
  profile=gpu-hq

> I couldn't find anything on bug.kde.org: should I forward ?

Yes please :)

Kind regards,
Nicholas


signature.asc
Description: PGP signature


Bug#1037268: kwin-x11: resource leak: the number of threads increases over time, boundlessly

2023-06-09 Thread Julien Muchembled
Package: kwin-x11
Version: 4:5.27.5-3
Severity: normal
Tags: upstream

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. Can anyone reproduce it ? More precisely:
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

Such a leak is at least a severe issue for anyone like me who set a nproc limit 
to protect against fork-bombs, in particular because it causes mysterious 
process crashes. I only understood the problem when I wanted to build a 
software that spawned a lot of processes. It also makes nproc limiting quite 
unusable without restarting KDE from time to time.

Version 4:5.27.2-2 was affected too. I previously had 4:5.24.4-1 and I'm almost 
sure it had no leak.

A few notes that may be specific to my setup:
- I do have a 4k intel display. And regularly, for less than 1s, the display is 
corrupted. I haven't tried Wayland yet and I hope it will fix it.
- I use mpv from deb-multimedia.
- mpv conf: vo = gpu

I couldn't find anything on bug.kde.org: should I forward ?

Julien

-- System Information:
Debian Release: 12.0
  APT prefers testing
  APT policy: (900, 'testing'), (800, 'unstable'), (700, 'proposed-updates'), 
(700, 'stable'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 
'stable-security'), (500, 'stable-debug'), (500, 'oldstable-proposed-updates'), 
(500, 'oldstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-9-amd64 (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages kwin-x11 depends on:
ii  kwin-common4:5.27.5-3
ii  libc6  2.36-9
ii  libepoxy0  1.5.10-1
ii  libgcc-s1  12.2.0-14
ii  libkdecorations2-5v5   4:5.27.5-2
ii  libkf5configcore5  5.103.0-2
ii  libkf5configgui5   5.103.0-2
ii  libkf5configwidgets5   5.103.0-1
ii  libkf5coreaddons5  5.103.0-1
ii  libkf5crash5   5.103.0-1
ii  libkf5globalaccel-bin  5.103.0-1
ii  libkf5globalaccel5 5.103.0-1
ii  libkf5i18n55.103.0-1
ii  libkf5notifications5   5.103.0-1
ii  libkf5plasma5  5.103.0-1
ii  libkf5service-bin  5.103.0-1
ii  libkf5service5 5.103.0-1
ii  libkf5windowsystem55.103.0-1
ii  libkwineffects14   4:5.27.5-3
ii  libkwinglutils14   4:5.27.5-3
ii  libqaccessibilityclient-qt5-0  0.4.1-1+b1
ii  libqt5core5a   5.15.8+dfsg-11
ii  libqt5dbus55.15.8+dfsg-11
ii  libqt5gui5 5.15.8+dfsg-11
ii  libqt5qml5 5.15.8+dfsg-3
ii  libqt5quick5   5.15.8+dfsg-3
ii  libqt5widgets5 5.15.8+dfsg-11
ii  libqt5x11extras5   5.15.8-2
ii  libstdc++6 12.2.0-14
ii  libx11-6   2:1.8.4-2
ii  libxcb-composite0  1.15-1
ii  libxcb-keysyms10.4.0-1+b2
ii  libxcb-randr0  1.15-1
ii  libxcb-render0 1.15-1
ii  libxcb-shape0  1.15-1
ii  libxcb-xfixes0 1.15-1
ii  libxcb-xkb11.15-1
ii  libxcb11.15-1
ii  libxi6 2:1.8-1+b1
ii  libxkbcommon-x11-0 1.5.0-1
ii  libxkbcommon0  1.5.0-1

kwin-x11 recommends no packages.

kwin-x11 suggests no packages.

-- no debconf information