Bug 425271 - XembedSNIProxy causes "high" cpu usage with certain screen arrangements
Summary: XembedSNIProxy causes "high" cpu usage with certain screen arrangements
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: XembedSNIProxy (show other bugs)
Version: 5.19.4
Platform: Manjaro Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords:
: 445411 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-08-12 19:52 UTC by kde
Modified: 2024-05-23 13:09 UTC (History)
27 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1
Sentry Crash Report:


Attachments
upgraded packages resolved the issue (4.59 KB, text/plain)
2020-08-23 09:33 UTC, kde
Details
perf data (without debug info) (2.74 MB, model/x.stl-binary)
2020-10-04 18:57 UTC, kde
Details
picture of flame graph with SW renderer enabled (183.60 KB, image/png)
2021-10-13 16:28 UTC, fawz
Details
picture of flame graph with SW renderer disabled (OpenGL used) (143.62 KB, image/png)
2021-10-13 16:29 UTC, fawz
Details
Compositor settings (34.93 KB, image/png)
2022-01-24 01:55 UTC, zyf0330
Details
Screen recording (1.10 MB, video/mp4)
2022-04-15 18:09 UTC, Graham Perrin
Details
.tar.gz archive of 8 screenshots forming a map of "good" and "bad" screen layouts (3.53 MB, application/gzip)
2022-07-27 07:20 UTC, Dominik Stańczak
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kde 2020-08-12 19:52:56 UTC
SUMMARY
I can clearly state, that XembedSNIProxy causes a "high" cpu usage round about 17% and causes Xorg to run at higher cpu usage around 23% as soon as a program is started, having (I guess) non kde conform tray icon. (supporting these tray icons is what XembedSNIProxy is made for, afaik).


STEPS TO REPRODUCE
1. Open program with non standard kde tray icon, like gajim or keepass

OBSERVED RESULT
Check for increased cpu usage


EXPECTED RESULT
No specific increase of cpu usage
Kill XembedSNIProxy and see cpu usage dropping afterwards to "normal"


SOFTWARE/OS VERSIONS
KDE-Plasma-Version: 5.19.4
KDE-Frameworks-Version: 5.73.0
Qt-Version: 5.15.0
Kernel-Version: 5.4.57-1
64-bit
Gajim 1.2.1
KeePass 2.45


ADDITIONAL INFORMATION

If I start XembedSNIProxy in shell, I got following messages:

qt.qpa.xcb: QXcbConnection: XCB error: 5 (BadAtom), sequence: 482, resource id: 0, major code: 20 (GetProperty), minor code: 0
Container window visible, stack below
Container window visible, stack below
Container window visible, stack below
Container window visible, stack below
Container window visible, stack below
Container window visible, stack below
Container window visible, stack below
Container window visible, stack below
....
Comment 1 kde 2020-08-23 09:33:29 UTC
Created attachment 131114 [details]
upgraded packages resolved the issue
Comment 2 kde 2020-08-23 09:34:59 UTC
After the latest system upgrade, the problem vanished, so one of the upgraded packages resolved the issue. Fur further investigation please see the attaced list.
Comment 3 kde 2020-08-26 18:07:21 UTC
Sorry, my first impression was wrong, there is still a high cpu usage in certain circumstances, e.g. directly after reboot and a start of program with tray icon.
Comment 4 Stefan 2020-10-03 13:55:06 UTC
I can confirm this issue on KDE Neon User Edition (Ubuntu 20.04)

@kde Do you have a NVIDIA GPU too?
Comment 5 kde 2020-10-03 18:24:57 UTC
@Stefan: Actually yes

See details:
product: GM107M [GeForce GTX 850M]
vendor: NVIDIA Corporation
Comment 6 Stefan 2020-10-03 18:36:58 UTC
Then I assume that's an issue with the nvidia driver. I can't reproduce this issue on my notebook (Intel GPU).

On my desktop computer the issue occurs at least with nvidia driver 450.x and 455.y.
Comment 7 David Edmundson 2020-10-03 22:58:17 UTC
>If I start XembedSNIProxy in shell, I got following messages:

Nothing has changed in xembedsniproxy in years. Could you get a snapshot with:
perf record --call-graph dwarf xembedsniproxy

Ideally with debug symbols. 

I don't see how it could be nvidia, there's no GL involved in any of this.
Comment 8 Stefan 2020-10-04 08:53:03 UTC
I've installed the package plasma-workspace-dbg before running perf:
https://nextcloud.draakgard.de/nextcloud/index.php/s/nCiFPiRcozFaBfx
Comment 9 David Edmundson 2020-10-04 12:11:38 UTC
thanks
Comment 10 kde 2020-10-04 18:57:00 UTC
Created attachment 132118 [details]
perf data (without debug info)
Comment 11 kde 2020-10-04 18:58:30 UTC
my perf data is smaller, but unfortunately without debug infos.
Comment 12 Stefan 2020-10-17 09:36:56 UTC
At the moment I don't observe this issue. I've upgraded to Plasma 5.20.0. And I've enabled the auto-start of the compositor again (there was a message box in the compositor settings).
Comment 13 Stefan 2020-10-17 11:58:40 UTC
Ok I've observed this issue again: The OpenGL detection of the compositor was disabled. After re-enabling the issue vanished.
Comment 14 northon_patrick3 2021-02-27 19:23:32 UTC
I have this problem too on KDE Plasma 5.21.1, framework version 5.79.0, running on X11 and proprietary nvidia drivers on a GTX 1070.

It spam the message "Container window visible, stack below" so bad that it filled my drive fairly quickly, I had to disable the session log file from sddm. It also make everything unresponsive as the X server is also running at 100%.

More info: I'm using 3 monitors, 2 bars have a system tray and both of them are vertical on the left side of their screen.
Comment 15 Konrad Materka 2021-03-27 15:59:51 UTC
@northon_patrick3 - do you have anything unusual installed or run? Can you check on new, fresh user? It this issue specific to one application? Any non-default setting for Kwin?
Comment 16 northon_patrick3 2021-03-27 20:23:56 UTC
(In reply to Konrad Materka from comment #15)
> @northon_patrick3 - do you have anything unusual installed or run? Can you
> check on new, fresh user? It this issue specific to one application? Any
> non-default setting for Kwin?

It's no longer doing it and I haven't changed anything, only installed updates. I'm on Arch (btw) which get frequent updates. I can however provide a few more clues: I noticed that it would always happen when I started Firefox. I have the plasma integration add-on in Firefox. I'm not sure if it's the only way but I could reproduce it consistently.
Comment 17 intlhouseofdan 2021-04-11 22:57:50 UTC
I have the same issue, it has plagued me for a long time now across two different installs of Manjaro. My issue too seems to be caused by Firefox running. In my case, if I try to open keepass, discord or element while Firefox is running (especially keepass), xsembedsniproxy goes crazy spamming my logs with "Container window visible, stack below" which brings xorg to its knees until i close the offending application.

I have noticed that with compositing turned on, the issue seems to go away, but I prefer it off because it is jittery and robs GPU resources. GTX1080 (nvidia drivers) and triple monitor here as well.
Comment 18 Konrad Materka 2021-04-15 21:15:32 UTC
intlhouseofdan, can you be more specific? Which version of Keepass are you using? On my distro (Neon) I have 3:
* keepassx (uses SNI)
* keepassxc (uses SNI)
* keepass2 (implemented in Mono, uses XEmbed) - only this one can cause troubles

Do you have any addons installed in Firefox that comunicates with Keepass?

I'm trying to reproduce this issue but I can't without more precise description.
Comment 19 Stefan 2021-04-15 21:28:20 UTC
I'm using firefox too but not keepass
Comment 20 Steven 2021-07-29 07:31:28 UTC
I'm observing the same behaviour with high cpu usage from xembedsniproxy. In my case I'm pretty sure it comes in combination with evolution-alarm-notify.

I first observed the high cpu after switching from Thunderbird to Evolution.
After some try and error with starting and stopping of evolution at all i found out that killing xembedsniproxy OR evolution-alarm-notify instantly stops the high cpu usage.

I'm also using firefox and keepassxc, but that combination never made problems until using evolution-mail.

Also running with nvidia (RTX 2060) and two monitors (Notebook build-in HD and external WQHD).

Compositing was turned off so far.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Leap 15.2
KDE Plasma Version: 5.18.6
KDE Frameworks Version: 5.71.0
Qt Version: 5.12.7
Kernel Version: 5.3.18-lp152.84-preempt
OS Type: 64-bit
NVIDIA driver: 470.57.02-lp152.43.1
Comment 21 Kay Simon 2021-08-10 22:38:46 UTC
I can reliable reproduce the issue when starting VeraCrypt.

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.84.0
Qt Version: 5.15.2
Kernel Version: 5.10.56-1-MANJARO (64-bit)
Graphics Platform: X11
Graphics Processor: NVIDIA GeForce GTX 1050 Ti/PCIe/SSE2
NVIDIA driver: 470.57.02
Comment 22 Leandro Lucarella 2021-10-07 07:09:34 UTC
I can confirm too.

Operating System: Debian GNU/Linux 11
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Kernel Version: 5.10.0-8-amd64 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-7700HQ CPU @ 2.80GHz
Memory: 15.5 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 630
Comment 23 fawz 2021-10-13 16:26:29 UTC
It's happening for me on openSUSE Tumbleweed as well, only when the Software Reneder is enabled. I can generate a perf on-cpu trace, but it's too big to be uploaded here and generating a report with perf script consumes all my memory before it's done.

Instead, I'll upload screenshots of overviews from hotspot with the perf trace loaded..
Comment 24 fawz 2021-10-13 16:28:19 UTC
Created attachment 142396 [details]
picture of flame graph with SW renderer enabled
Comment 25 fawz 2021-10-13 16:29:41 UTC
Created attachment 142397 [details]
picture of flame graph with SW renderer disabled (OpenGL used)
Comment 26 intlhouseofdan 2021-10-13 16:55:37 UTC
(In reply to Konrad Materka from comment #18)
> intlhouseofdan, can you be more specific? Which version of Keepass are you
> using? On my distro (Neon) I have 3:
> * keepassx (uses SNI)
> * keepassxc (uses SNI)
> * keepass2 (implemented in Mono, uses XEmbed) - only this one can cause
> troubles
> 
> Do you have any addons installed in Firefox that comunicates with Keepass?
> 
> I'm trying to reproduce this issue but I can't without more precise
> description.

Sorry for the late reply. I am using what I believe is keypass2 v2.49 which is in the official repos for Manjaro.
Comment 27 fawz 2021-10-14 14:44:19 UTC
Actually, it's happening with software rendering disabled too, now. I'll see if I can find the common cause in another perf trace.

FWIW, my xembedsniproxy version is 5.22.5-3.1.
Comment 28 fawz 2021-10-26 19:26:21 UTC
> I'm trying to reproduce this issue but I can't without more precise
> description.

I'll add which programs I'm using which seem to reproduce this.

- the element matrix client, element-1.9.2-1.suse.tw.taw, from the repo https://github.com/taw00/element-rpm/
- gajim, gajim-1.3.2-1, from the official oss opensuse tumbleweed repos

KDE and system versions:

Operating System: openSUSE Tumbleweed 20211016
KDE Plasma Version: 5.23.0
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Kernel Version: 5.14.11-1-default (64-bit)
Graphics Platform: X11
amdgpu driver
Comment 29 Leandro Lucarella 2021-10-31 16:34:44 UTC
For me this happens consistently with BackInTime, usually when it runs after resuming from suspend. When it is doing a backup and the notification area icon is shown, xembedsniproxy uses ~65% CPU (and xorg 100%).
Comment 30 William 2021-11-24 11:50:19 UTC
I am experiencing the same issue with Nextcloud and Firefox when I stop the compositor. The moment the compositor is stopped, Xorg process pins CPU at 100% and xembedsniproxy goes to approximately 65%, with the logs spamming the same message, xembedsniproxy: Container window visible, stack below. This locks up the system - htop updates once every 30 seconds at best, Firefox and Discord freeze completely, and any game running freezes as well. If a terminal is not already open and selected for me to rectify (by restarting the compositor), the system must be forcibly rebooted.

I discovered this issue with Lutris - its disable compositor option froze my system. This isn't 100% reproducible for me, for example I just closed Nextcloud and Firefox and reopened them, and no error occurred. But it can start randomly - I have also experienced opening a link from Discord while in a game, and it opened Firefox - completely freezing the system.

Manjaro, KDE Plasma 5.23.3, Frameworks 5.88.0, Qt Version 5.15.2, Kernel 5.13.19-2-MANJARO, NVIDIA 3080 GPU.
Comment 31 David Edmundson 2021-11-29 22:24:21 UTC
*** Bug 445411 has been marked as a duplicate of this bug. ***
Comment 32 David Edmundson 2021-11-29 22:29:44 UTC
>only when the Software Reneder is enable

Which software rendererer are you referring to?

We have some logic in xembedsniproxy that says "if our hidden window is shown, send it to the back again".  Clearly someone else is putting our window back again. Possibly a new kwin change.

Can you confirm that openbox --replace silences the issue?
Can you also enable any debug in kwin and see if that shows anything?
Comment 33 Bug Janitor Service 2021-12-14 04:35:11 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 34 Leandro Lucarella 2021-12-15 15:20:50 UTC
(In reply to David Edmundson from comment #32)
> We have some logic in xembedsniproxy that says "if our hidden window is
> shown, send it to the back again".  Clearly someone else is putting our
> window back again. Possibly a new kwin change.
> 
> Can you confirm that openbox --replace silences the issue?
> Can you also enable any debug in kwin and see if that shows anything?

Ah, interesting. I'm using i3, so no kwin for me. I'll try i3 --replace when this happens to see if it changes anything.
Comment 35 intlhouseofdan 2021-12-15 19:57:58 UTC
I gave up on this getting fixed and just close it as soon as the system boots. I can live without the icons in the tray.
Comment 36 zyf0330 2022-01-13 03:54:06 UTC
I have this problem too. And I must kill xembedsniproxy. After xembedsniproxy is killed, nothing happens but some windows start to have a white thin border.
Comment 37 Konrad Materka 2022-01-23 21:38:28 UTC
intlhouseofdan - some versions of keepass still use old XEmbed protocol to display tray icon. Your issue is unrelated to Firefox. 

zyf0330 and intlhouseofdan: Can you give more details about your setup? Are you using different compositor or desktop manager? Did you change any setting (for example, software rendering)?

As a workaround, you can use:

killall xembedsniproxy; wmsystemtray --non-wmaker --bgcolor white

This will show XEmbed tray icons in a separate window. All modern tray items (SNI) will work as currently, unimpacted.
Comment 38 zyf0330 2022-01-24 01:55:19 UTC
Created attachment 145829 [details]
Compositor settings

I use Ubuntu 21.10 with KDE Plasma, and SDDM compositor whose settings is in attachment.

After do that workground, there are three tray icons appearing in separate window. They are emojione-picker, xpad, wine.
Comment 39 zyf0330 2022-01-24 02:01:35 UTC
Another related thing is, after change compositor settings (when use OpenGL 3.1 or OpenGL 2.0) and apply, the whole screen is lag, except I use Xrender. My previous computer has no this problem, current computer is too old which is MSI GE60 2PG. So Maybe it is a hardware compatibility problem.
Comment 40 zyf0330 2022-01-24 02:50:39 UTC
(In reply to zyf0330 from comment #38)
> Created attachment 145829 [details]
> Compositor settings
> 
> I use Ubuntu 21.10 with KDE Plasma, and SDDM compositor whose settings is in
> attachment.
> 
> After do that workground, there are three tray icons appearing in separate
> window. They are emojione-picker, xpad, wine.

It is weired, I try to retry but this problem disappears.
I try to disable all these three applications autostart, and enable one by one, at the same time I switch Render Backend between OpenGL 3.1 and Xrender, but XembedSNIProxy doesn't use high cpu every reboot. AND, I resume all these settings, this problem doesn't appear too!

The only variable is, I changed kernel version from 5.13.0-22-generic to 5.13.0-27-generic before do this. But switch Render Backend to OpenGL is still lag, unless I set OpenGL and reboot and doesn't touch Compositor settings.
Comment 41 Graham Perrin 2022-04-02 11:33:18 UTC
Screen recording: <https://photos.app.goo.gl/2vxdDmsFdpNhsb596> (50 seconds) – starting Remmina.

Observe the clock (bottom left) pause at 09:33:16 (around 00:28 on the timeline), again at 09:33:24, again at 09:33:27, again at 09:33:36. 

Hogging of the CPU is visible more in GKrellM (to the right) than in htop (background). 

Generally, the desktop environment becomes almost completely unresponsive until I kill: 

/usr/local/bin/xembedsniproxy

For me, the problem: 

* began a few weeks ago – almost certainly before Friday 4th March
* is reproducible on campus, with a wired network connection
* is _not_ reproducible at home, with a wired network connection. 

### Environment

Operating System: FreeBSD 14.0
KDE Plasma Version: 5.24.3
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.2
Kernel Version: 14.0-CURRENT (64-bit)
Graphics Platform: X11
Memory: 15.9 GiB of RAM
Graphics Processor: AMD TURKS

% pkg provides /usr/local/bin/xembedsniproxy
Name    : plasma5-plasma-workspace-5.24.3_2
Desc    : Plasma5 Plasma workspace
Repo    : FreeBSD
Filename: usr/local/bin/xembedsniproxy
% pkg info -x net/remmina x11/plasma5-plasma-workspace
remmina-1.4.17
plasma5-plasma-workspace-5.24.3_2
% pkg -vv | grep -e url -e enabled
    url             : "pkg+http://pkg0.pkt.freebsd.org/FreeBSD:14:amd64/latest",
    enabled         : yes,
    url             : "https://alpha.pkgbase.live/current/FreeBSD:14:amd64/latest",
    enabled         : no,
    url             : "file:///usr/local/poudriere/data/packages/main-default",
    enabled         : yes,
% uname -aKU
FreeBSD mowa219-gjp4-8570p-freebsd 14.0-CURRENT FreeBSD 14.0-CURRENT #7 main-n253861-92e6b4712b5-dirty: Sat Mar 19 02:40:21 GMT 2022     root@mowa219-gjp4-8570p-freebsd:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG amd64 1400053 1400053
%
Comment 42 Kevin Gagnon 2022-04-14 19:51:27 UTC
I might have some insight to provide, or mine is just a weird extra edge case triggering a similar problem. Basically the problem of high cpu only occurs depending on how I have my screens setup relative to each other.

If I have my upper screen moved to the right, right aligned with the screen below it so there is a gap on the left, the issue occurs after hitting apply. See pic: https://i.imgur.com/JW1jWEk.png

If I have my upper screen moved to the left, left aligned with the screen below it so there is a gap on the left, the issue is gone after hitting apply. See pic: https://i.imgur.com/f24r5M4.png

If I have my screens all along a horizontal line, no issue.

When the issue is occuring, Xorg is doing 96% cpu usage, xembedsniproxy is doing 78% cpu usage, and kwin_x11 is doing 63% cpu usage, cpu is i7 4790K.

Compositor is off.

Operating System: KDE neon 5.19
KDE Plasma Version: 5.19.4
KDE Frameworks Version: 5.72.0
Qt Version: 5.14.2
Kernel Version: 4.15.0-corobuild-acso
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-4790K CPU @ 4.00GHz
Memory: 31.4 GiB of RAM
Graphics Processor: GeForce GTX 1070 Ti/PCIe/SSE2
Comment 43 Graham Perrin 2022-04-15 18:09:42 UTC
Created attachment 148178 [details]
Screen recording

(In reply to Graham Perrin from comment #41)

> … For me, the problem: 
> 
> * began a few weeks ago – almost certainly before Friday 4th March
> * is reproducible on campus, with a wired network connection
> * is _not_ reproducible at home, with a wired network connection. 
> 
> ### Environment
> 
> … 

I'm not yet certain, but from a few test results I suspect that I can avoid the issue (on campus) by using the JavaEmbeddedFrame in my system tray to quit LanguageTool before starting Remmina. 

This screen recording (at home, without attempting to start Remmina) shows use of the context menu for the JavaEmbeddedFrame icon for LanguageTool. 

<https://dev.languagetool.org/http-server>
Comment 44 Marco Albanese 2022-05-24 16:15:25 UTC
I have the same behavior as Kevin Gagnon ( comment #42) in a "more traditional" setup: I've two monitors, one external (21:9 curved, but maybe it's not relevant), and the laptop built-in.
My laptop is physically on my right so my conf is:
LAPTOP Screen | EXTERNAL
In this scenario, when I use the openlens application, I suffer the high CPU usage of XembedSNIProxy.
Keeping the application opened and flipping the display configurations as follows:
EXTERNAL | LAPTOP Screen
make the issue disappears.
Additionally, making one display primary or vertical align the laptop screen on the top line doesn't change anything.


SOFTWARE/OS VERSIONS
Archlinux
KDE-Plasma-Version: 5.24.5-2
Qt-Version: 5.15.4
Kernel-Version: 5.15.41-1-lts
64-bit
Comment 45 Dominik Stańczak 2022-07-27 06:37:29 UTC
Oh wow, yeah, I just tried reproducing Kevin Gagnon's  "workaround" and placing the laptop screen to the left of the external screen in system settings does stop xembedsniproxy from spamming to the journal. That's pretty mindblowing.

To specify, my settings change changed the following two lines of `xrandr` output:

eDP-1 connected primary 1920x1080+0+420 (normal left inverted right x axis y axis) 344mm x 194mm
HDMI-1-0 connected 1080x1920+1920+0 left (normal left inverted right x axis y axis) 531mm x 299mm

to:

eDP-1 connected primary 1920x1080+1080+520 (normal left inverted right x axis y axis) 344mm x 194mm
HDMI-1-0 connected 1080x1920+0+0 left (normal left inverted right x axis y axis) 531mm x 299mm

SOFTWARE/OS VERSIONS
Archlinux
KDE-Plasma-Version: 5.25.3
Qt-Version: Qt 5.15.5
Kernel-Version: 5.18.14
64-bit
Comment 46 Dominik Stańczak 2022-07-27 07:18:40 UTC
I've done a little more digging with the geometry. There are "bad" layouts, where XembedSNIProxy is noisy, and "good layout", where it doesn't complain.  If the config is wrong, xembedsniproxy dumps hundreds of thousands of logs. I initially thought they were being printed periodically, roughly every 30s, for about 2s, but they were instead simply getting suppressed by systemd, given `systemd-journald[218]: [🡕] Suppressed 195123 messages from user@1000.service)` reocurring.

I'm going to attach a few screenshots of the "map" of layouts, but the gist is: in a dual monitor setting, IF the external monitor is to the right of the main monitor AND has its top border anywhere above the extent of the main monitor, xembedsniproxy starts spamming. This is true whether the external monitor is in horizontal or vertical mode. 

Does anyone have ideas on why that might be?
Comment 47 Dominik Stańczak 2022-07-27 07:20:15 UTC
Created attachment 150937 [details]
.tar.gz archive of 8 screenshots forming a map of "good" and "bad" screen layouts
Comment 48 Urmet Saar 2022-08-17 13:06:03 UTC
The screen layout discovery is great, I have extra portrait monitor that has top edge higher. I usually do a quick "killall xembedsniproxy" right after logging in, but forgot today, so it was running for about 8 hours. Session log has over 10 **million** lines of "Container window visible, stack below"
Comment 49 David Edmundson 2022-08-17 13:58:18 UTC
So basically it's "bad" if there's no screen at 0,0 in global space. 

Thanks. That should be enough to help trigger this locally.
Comment 50 Marcin Kasperski 2022-08-31 18:23:21 UTC
It is amazing. With this setup (smaller monitor on the left, vertically centered) my ~/.xsession-errors is spammed with huge volume of „Container window visible, stack below”:

https://pasteboard.co/FoXmuIxWfCuD.png

Moving left screen  slightly up (so tops are aligned), puff, problem gone:

https://pasteboard.co/SNQYJxFRSZMd.png

It happens immediately, Apply in Display settings window and it stops/starts.
Comment 51 Florian Schrön 2022-12-12 20:32:47 UTC
(In reply to Marcin Kasperski from comment #50)
> It is amazing. With this setup (smaller monitor on the left, vertically
> centered) my ~/.xsession-errors is spammed with huge volume of „Container
> window visible, stack below”:
> 
> https://pasteboard.co/FoXmuIxWfCuD.png
> 
> Moving left screen  slightly up (so tops are aligned), puff, problem gone:
> 
> https://pasteboard.co/SNQYJxFRSZMd.png
> 
> It happens immediately, Apply in Display settings window and it stops/starts.

same here with vertical monitor setup (up / down).
When aligning both to the left edge, the error is instantly gone.

With center alignment applied, the ~/.xsession-errors is flooded with "Container window visible, stack below".
in the 15 seconds until automatic config rollback after reply i got 118966 error lines. 

> $ tail -fn0 .xsession-errors  | ts > /tmp/.xsession-errors.ts    # while the 15 seconds of center aligned setup
> $ grep -c "Container window visible, stack below" /tmp/.xsession-errors.ts
> 118966

Packages (@Linux Mint 21):
> plasma-workspace 4:5.24.7-0ubuntu0.1 from ubuntu/jammy-updates (contains xembedsniproxy)
> plasma-desktop 4:5.24.7-0ubuntu0.1 from ubuntu/jammy-updates
Comment 52 Matt 2023-01-28 09:36:23 UTC
So glad I stumbled upon this. I was seeing log spam and plasmashell freeze up when I went full screen in mpv. aligning the borders of the monitors makes things go away, as suggested. Very frustrating these needs to be done for my workspace, though
Comment 53 Jim 2023-05-20 10:38:55 UTC
This is probably caused by the fix to https://bugs.kde.org/show_bug.cgi?id=357443.

There's this bit in fdoselectionmanager.cpp

> else if (responseType == XCB_VISIBILITY_NOTIFY) {
>       const auto event = reinterpret_cast<xcb_visibility_notify_event_t *>(ev);
>        // it's possible that something showed our container window, we have to hide it
>        // workaround for BUG 357443: when KWin is restarted, container window is shown on top
>        if (event->state == XCB_VISIBILITY_UNOBSCURED) {
>            for (auto sniProxy : m_proxies.values()) {
>                sniProxy->hideContainerWindow(event->window);
>            }
>        }
>    }

Where does the XCB_VISIBILITY_UNOBSCURED event originate? Is it a bug that a window is reported as unobscured if it's located on an offscreen position? Or is it the responsibility of the client to check if the window is unobscured and on-screen?
Comment 54 J 2024-05-19 10:12:37 UTC
Hi, any chance this bug gets fixed? Still happens with Plasma 6.0.4
Comment 55 Bug Janitor Service 2024-05-23 11:52:24 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4345
Comment 56 Konrad Materka 2024-05-23 13:07:40 UTC
Git commit efecf88d2d77d8f4cd94edb3a83d10deb16a1e92 by Konrad Materka.
Committed on 23/05/2024 at 12:34.
Pushed by kmaterka into branch 'master'.

xembedsniproxy: Fix high CPU usage when 0,0 is off-screen

Reverts 69786a1ff94718daf4de2d814037e70df079ec97, which is no longer needed after 50bbe56bb08f9b265ad56510e2adc37db66f4d2d

Initial workaround for Bug 357443 tries to detect and fix window stacking issues (for example after compositor restart). Unfortunately, it causes infinite loop when (0,0) position (were windows are originally positioned) is off-screen (this can happen in some less commonmulti-screen setups).
Proper fix was added in !4324, so that faulty workaround is no longer needed.

M  +0    -9    xembed-sni-proxy/fdoselectionmanager.cpp
M  +1    -14   xembed-sni-proxy/sniproxy.cpp
M  +0    -2    xembed-sni-proxy/sniproxy.h

https://invent.kde.org/plasma/plasma-workspace/-/commit/efecf88d2d77d8f4cd94edb3a83d10deb16a1e92