Bug 444385 - Right-click on GTK icon in systray leads to fast random mouse clicks events
Summary: Right-click on GTK icon in systray leads to fast random mouse clicks events
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: System Tray (show other bugs)
Version: 5.23.2
Platform: Arch Linux Linux
: VHI normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression
: 443925 444409 444690 445205 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-10-25 20:26 UTC by Faerbit
Modified: 2022-02-11 16:08 UTC (History)
12 users (show)

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


Attachments
Errant Mouse After Tray Click (63.01 KB, image/jpeg)
2021-10-27 16:58 UTC, vindicator
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Faerbit 2021-10-25 20:26:15 UTC
SUMMARY
Right-click on icon in systray leads to fast random mouse clicks

STEPS TO REPRODUCE
1. Run desktop a few hours (not reproducible directly after boot)
2. Right click on an icon in systray

OBSERVED RESULT
Very fast random mouse clicks. At least this is my guess. Essentially my desktop freaks out.  I will attach a video. Only way to stop it is, to kill Xorg and reboot.


EXPECTED RESULT
Normal right click menu should open

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Archlinux
(available in About System)
KDE Plasma Version: 5.23.1
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2
Comment 1 Faerbit 2021-10-25 20:44:19 UTC
Actually does not seem to be related to the uptime of the system. I can reliably reproduce with Firefox running a Twitch.tv stream.
I can confirm the problem with these two applications:
- Wire (Electron application)
- Gajim (XMPP Client)
Comment 2 Faerbit 2021-10-25 20:53:39 UTC
Here is a video of the issue happening:
https://youtu.be/SGVwq4sj33Q

The system state gets progressively worse over a few seconds.
I right clicked the Wire Icon (tooltip electron11) two times with a few seconds in between. I am trying to minimize the Firefox window.
The twitch stream stopping is part of symptoms.

If there is additional info needed or if I should try something specific, just ask!
Comment 3 Faerbit 2021-10-25 20:54:55 UTC
Also happended to me without Firefox running, it's just that somehow Firefox running a Twitch streams leads to reliable reproduction of this issue.
Comment 4 Faerbit 2021-10-26 20:30:30 UTC
Bug seems to be caused by plasma-workspace repo.
v5.22.5: Everything works as expected
v5.22.90: There is no random inputs happening, but the menu also doesn't open
v5.23.0: The original described behaviour happens.

I will try to bisect further.
Comment 5 Faerbit 2021-10-27 16:03:44 UTC
I identified that the following commit introduced this behaviour:
https://invent.kde.org/plasma/plasma-workspace/-/commit/6545d5584d01c452121efcb12305d7f1fde84b4d
Comment 6 Faerbit 2021-10-27 16:16:19 UTC
I did some more testing and can conclude that only applications using GTK3 are causing this behaviour. Qt applications work fine even with the bug introducing commit applied.
Comment 7 vindicator 2021-10-27 16:58:02 UTC
Created attachment 142947 [details]
Errant Mouse After Tray Click

OH MY GOD! This is BY FAR the MOST egregious bug I've encountered with KDE... and that's so far beyond the "desktop icon scrambling" bug or the wayland issues, and it MUST get the highest priority nate/david/feck/whomever!

I just now encountered this issue, and I had just upgraded my system last night, since my previous upgrade was on the 13th.

I was composing an email reply in my browser and went to open up skype in the system tray and EVERYTHING went haywire. I had no control over "context menu" actions that were being taken.

The browser brought up developer-tools. I figured it may be related to the compositor since dropping x-render happened, but on the other hand I don't see how since compositing and actions shouldn't be related.
But still, I went to bring up settings and that too went haywire and the entire task tray started filling up.

I had to switch to another tty since I couldn't stop any of it. I killed plasmashell, and I think that did it, but the damage was done, as shown in the attached image.
I had already started removing a lot of those extra "settings" in the bar, but doesn't look like I made a dent, so I'm going to look for whatever file is in charge of the layout and manually clean it up there since that should be faster.

In the journal, when it all went wrong (start at the bottom):
*****
...//More spam. Essentially 4-5 minutes of ungodly stress.
Oct 27 11:13:05 computerName kwin_x11[1416]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 22988, resource id: 25168137, major code: 18 (ChangeProperty), minor code: 0
Oct 27 11:13:05 computerName kwin_x11[1416]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 22984, resource id: 25168136, major code: 18 (ChangeProperty), minor code: 0
...//"Too many open files" you say? Nooooo /s
Oct 27 11:12:17 computerName plasmashell[1499]: QProcessPrivate::createPipe: Cannot create pipe 0x5608cbbdb9b8 (Too many open files)
Oct 27 11:12:17 computerName plasmashell[1499]: QProcessPrivate::createPipe: Cannot create pipe 0x5608c7f26fa8 (Too many open files)
Oct 27 11:12:17 computerName plasmashell[1499]: Opening menu at 40 43
Oct 27 11:12:17 computerName plasmashell[1499]: file:///usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/ui/KickoffItemDelegate.qml:140:9: QML IconItem: grabToImage: item's window is not visible
Oct 27 11:12:17 computerName plasmashell[1499]: Opening menu at 40 42
...//More spamming.
Oct 27 11:12:00 computerName systemd[1383]: Started System Settings.
░░ Subject: A start job for unit UNIT has finished successfully
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit UNIT has finished successfully.
░░ 
░░ The job identifier is 820.
...
Oct 27 11:11:20 computerName plasmashell[1499]: file:///usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/ui/KickoffItemDelegate.qml:140:9: QML IconItem: grabToImage: item's window is not visible
Oct 27 11:11:20 computerName plasmashell[1499]: Opening menu at 40 44
Oct 27 11:11:20 computerName plasmashell[1499]: file:///usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/ui/KickoffItemDelegate.qml:140:9: QML IconItem: grabToImage: item's window is not visible
...//Also being spammed
Oct 27 11:10:57 computerName plasmashell[1499]: Opening menu at 69 62
Oct 27 11:10:57 computerName plasmashell[1499]: Opening menu at 80 66
Oct 27 11:10:57 computerName plasmashell[1499]: Opening menu at 80 66
Oct 27 11:10:57 computerName plasmashell[1499]: Opening menu at 88 67
...//HA! Yeah, make that thousands (lines 12304->47723).
Oct 27 11:09:05 computerName kwin_x11[1416]: kwin_core: XCB error: 3 (BadWindow), sequence: 20823, resource id: 60817682, major code: 129 (SHAPE), minor code: 6 (Input)
Oct 27 11:09:05 computerName kwin_x11[1416]: kwin_core: XCB error: 152 (BadDamage), sequence: 20822, resource id: 15787929, major code: 143 (DAMAGE), minor code: 2 (Destroy)
Oct 27 11:08:49 computerName kwin_x11[1416]: qt.qpa.xcb: QXcbConnection: XCB error: 9 (BadDrawable), sequence: 226, resource id: 60817649, major code: 14 (GetGeometry), minor code: 0
Oct 27 11:09:40 computerName plasmashell[45590]: [45638:45661:1027/110928.838481:ERROR:latency_info.cc(112)] CompositorFrameSinkSupport::MaybeSubmitCompositorFrame, LatencyInfo vector size 704 is too big.
Oct 27 11:09:40 computerName plasmashell[45590]: [45638:45661:1027/110919.123894:ERROR:latency_info.cc(112)] CompositorFrameSinkSupport::MaybeSubmitCompositorFrame, LatencyInfo vector size 111 is too big.
Oct 27 11:09:40 computerName plasmashell[45590]: [45638:45661:1027/110913.454962:ERROR:latency_info.cc(112)] CompositorFrameSinkSupport::MaybeSubmitCompositorFrame, LatencyInfo vector size 105 is too big.
Oct 27 11:09:40 computerName plasmashell[45590]: [45638:45661:1027/110859.333681:ERROR:latency_info.cc(112)] CompositorFrameSinkSupport::MaybeSubmitCompositorFrame, LatencyInfo vector size 126 is too big.
Oct 27 11:09:28 computerName systemd-journald[864]: [🡕] Suppressed 9834 messages from user@1000.serviceSubject: Messages from a service have been suppressed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ Documentation: man:journald.conf(5)
░░ 
░░ A service has logged too many messages within a time period. Messages
░░ from the service have been dropped.
░░ 
░░ Note that only messages from the service in question have been
░░ dropped, other services' messages are unaffected.
░░ 
░░ The limits controlling when messages are dropped may be configured
░░ with RateLimitIntervalSec= and RateLimitBurst= in
░░ /etc/systemd/journald.conf or LogRateLimitIntervalSec= and LogRateLimitBurst=
░░ in the unit file. See journald.conf(5) and systemd.exec(5) for details.
...//hundreds of these dbusmenu. I can page-through for seconds before 1 second of log elapses.
Oct 27 11:08:13 computerName plasmashell[1499]: Could not find DBusMenu interface, falling back to calling ContextMenu()
Oct 27 11:08:13 computerName plasmashell[1499]: Could not find DBusMenu interface, falling back to calling ContextMenu()
Oct 27 11:07:44 computerName kwin_x11[1416]: qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 55120, resource id: 15725308, major code: 20 (GetProperty), minor code: 0
...
*****

In short, you've got me terrified to touch the system tray.
Comment 8 vindicator 2021-10-27 17:03:03 UTC
/home/userName/.config/plasma-org.kde.plasma.desktop-appletsrc
*****
[Containments][2][Applets][175][Configuration]
localPath=/home/username/.local/share/plasma_icons/systemsettings (75).desktop
url=file:///usr/share/applications/systemsettings.desktop
*****

75 instances? Yeah, no way would I have enjoyed manually clicking/removing them one-by-one.
Comment 9 David Edmundson 2021-10-27 17:04:34 UTC
If you want it fixed please don't make it harder to find the useful information that faerbit has gathered.
Comment 10 vindicator 2021-10-27 17:59:41 UTC
? I saw no acknowledgement of the issue, including whether or not the suspected commit relates to the bug, and I was lending my experience with the issue AND including log output, whether it affirms the commit or may point elsewhere.

I had no idea my submission would be a hindrance.
Carry-on and ignore if you already know what's up.
Comment 11 David Edmundson 2021-10-27 19:06:31 UTC
Of course: KWindowSystem::lastInputSerial does nothing on x11 and as the connection persists that lambda will keep firing.
Comment 12 Bug Janitor Service 2021-10-27 22:41:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1149
Comment 13 David Edmundson 2021-10-27 22:45:02 UTC
Faerbit as you were already compiling things, could you test that patch. 
I've had to guess at the causes from the clues above, so I can't be 100% sure it fixes your problem.
Comment 14 Faerbit 2021-10-28 17:27:27 UTC
I tested the patch, and it stops the synthesised input events, so no more freaky mouse clicks all over the place. But apparently it stops all of these, since the right-click menu doesn't open, which it does with v5.22.5.
Comment 15 Nate Graham 2021-10-28 18:07:13 UTC
Git commit e55c2744cd13b00d2ca379b34e167ca381b2e7d7 by Nate Graham, on behalf of David Edmundson.
Committed on 28/10/2021 at 18:00.
Pushed by ngraham into branch 'master'.

Disconnect watcher for xdgActivationTokenArrived

XdgActivationTokens are loaded async. To acheive a job like pattern we
were comparing serials in our slot when one was created.

On wayland this isn't ideal because we're slowly building up an
increasibly long list of lambdas being run, but they'll all no-op.

On X11 because lastInputSerial is always 0 we run the slot multiple
times for every system tray item each time an item is clicked or an
application is launched.

For xembedsniproxy this is especially problematic problematic as we will
trigger synthesised input events in our slot.

M  +4    -1    applets/systemtray/statusnotifieritemjob.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/e55c2744cd13b00d2ca379b34e167ca381b2e7d7
Comment 16 Nate Graham 2021-10-28 18:07:50 UTC
Git commit 7f18bc04d74117525141d43f857f8d9f03b17ce3 by Nate Graham, on behalf of David Edmundson.
Committed on 28/10/2021 at 18:07.
Pushed by ngraham into branch 'Plasma/5.23'.

Disconnect watcher for xdgActivationTokenArrived

XdgActivationTokens are loaded async. To acheive a job like pattern we
were comparing serials in our slot when one was created.

On wayland this isn't ideal because we're slowly building up an
increasibly long list of lambdas being run, but they'll all no-op.

On X11 because lastInputSerial is always 0 we run the slot multiple
times for every system tray item each time an item is clicked or an
application is launched.

For xembedsniproxy this is especially problematic problematic as we will
trigger synthesised input events in our slot.


(cherry picked from commit e55c2744cd13b00d2ca379b34e167ca381b2e7d7)

M  +4    -1    applets/systemtray/statusnotifieritemjob.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/7f18bc04d74117525141d43f857f8d9f03b17ce3
Comment 17 Faerbit 2021-10-28 18:12:10 UTC
I am confused. Will the breakage of the right-click menu not be addressed?
Comment 18 Faerbit 2021-10-28 19:10:49 UTC
Thank you for the fix, and for reopening this. If you need further testing I will gladly do it.
Comment 19 Nick Stefanov 2021-10-30 09:23:29 UTC
This happens with Java applications too. When I use Jdownloader2, if I right click on it's systray icon, Plasma goes CRAZY - I can't click anywhere, small black boxes are opening around the panel, archives are created here and there, favorites are being added to the side panel in Dolphin, etc. - it's a disaster. Only a restart fixes that. 
I observe one more problem related to systemtray - if I have Viber loaded, after certain amount of time there are misclicks - for example, if I click on qBittorrent's icon, Viber context menu opens along with qBittorrent's menu. If I quit Viber, this fixes the problem for a while.
Comment 20 kderemie 2021-11-01 04:23:13 UTC
Every release I hope this will be fixed! KDE has only two significant stability issues for me, and this is one of them. I have to restart plasmashell at least twice a day.
Comment 21 Nate Graham 2021-11-01 16:25:09 UTC
*** Bug 444690 has been marked as a duplicate of this bug. ***
Comment 22 Faerbit 2021-11-09 22:00:00 UTC
Maybe I didn't test correctly before. However it is completely fixed in 5.23.3 for me; right-click opens the menu as before.
Comment 23 Nate Graham 2021-11-09 22:03:56 UTC
*** Bug 445205 has been marked as a duplicate of this bug. ***
Comment 24 Konrad Materka 2021-12-29 23:12:22 UTC
*** Bug 444409 has been marked as a duplicate of this bug. ***
Comment 25 Konrad Materka 2021-12-30 08:26:35 UTC
*** Bug 443925 has been marked as a duplicate of this bug. ***
Comment 26 Nick Stefanov 2022-02-09 21:53:45 UTC
Sadly, with Plasma 5.24 the problem is here again .
Comment 27 David Edmundson 2022-02-11 10:24:30 UTC
>Sadly, with Plasma 5.24 the problem is here again .

The same bug with the same cause is not. 

Your comment in #19 also didn't quite match the original report. Please reopen a new bug so we don't confuse it with old information and provide some more details as to what is broken.
Comment 28 Nick Stefanov 2022-02-11 10:47:51 UTC
My fault, I'm sorry.
Comment 29 Michael 2022-02-11 15:55:33 UTC
(In reply to David Edmundson from comment #27)
> Your comment in #19 also didn't quite match the original report. Please
> reopen a new bug so we don't confuse it with old information and provide
> some more details as to what is broken.

I was able to trigger the "click storm" event with 5.24, by holding down left mouse button on a tray icon. Click-and-hold.
Comment 30 Nate Graham 2022-02-11 16:08:04 UTC
The original issue was about right-clicking, so it does indeed sounds like a different problem.