Bug 388182 - Plasma breaks when taking a screenshot of chromium
Summary: Plasma breaks when taking a screenshot of chromium
Status: RESOLVED DUPLICATE of bug 338489
Alias: None
Product: kwin
Classification: Plasma
Component: effects-various (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 391118 407373 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-12-23 22:32 UTC by Altguard
Modified: 2019-05-27 14:46 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
gdb output (788 bytes, text/plain)
2017-12-25 04:41 UTC, Altguard
Details
Xorg log from | xdotool key XF86LogGrabInfo (429.54 KB, text/x-log)
2018-01-12 10:08 UTC, Altguard
Details
Xorg log from | xdotool key XF86LogGrabInfo (212.36 KB, text/x-log)
2018-01-12 18:05 UTC, Altguard
Details
Output of | qdbus org.kde.KWin /KWin supportInformation (5.36 KB, text/plain)
2018-01-12 23:46 UTC, Altguard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Altguard 2017-12-23 22:32:26 UTC
Taking an active window screenshot of a web page in Chromium often causes Plasma to break in a number of ways -  any hidden toolbars will become permanently visible, many windows will loose their window decoration and become unable to be moved, clicking on a different window doesn't change window focus and bring it to the forefront, various widgets stop  working, etc. etc. 

This seems  to only happen with Chromium window screenshots - I can't recreate  the bug with screenshots of any other application or web browser.

The link below is a video of the bug:
https://youtu.be/_mrwpKCwZ2Y
Comment 1 David Edmundson 2017-12-24 22:07:41 UTC
From your video kwin's locked (but not dead, which is why you can't --replace it)

Can you run the following:

switch to a TTY (or ssh in from another computer)
run "sudo gdb --pid `pidof kwin_x11`"

when that loads type

set logging on
set pagination off
bt


then quit

you should then find a file called gdb.txt in that directory.
Comment 2 Altguard 2017-12-25 04:41:48 UTC
Created attachment 109506 [details]
gdb output
Comment 3 Altguard 2017-12-25 04:42:31 UTC
I'm unclear as  to whether or not you'd like for me to  run gdb on the process before or after kwin locks, so I tried both.

Trying to run it after locking kwin, I get "ptrace: No such process". After searching through htop and ksysguard, it seems like the kwin_x11 process is entirely gone after screenshotting Chromium, and running "kwin_x11" from konsole actually fixes the problem.

The attached file is from running gdb while kwin is still working properly (Which I'm assuming is not what you needed from me, but its  there just  in case).
Comment 4 Altguard 2017-12-25 06:30:18 UTC
Also, it just  crossed my mind to screenshot Chromium after restarting kwin_x11 in konsole, which produces this:

===============================================================================
$ kwin_x11
QXcbConnection: XCB error: 3 (BadWindow), sequence: 172, resource id: 2097158, major code: 20 (GetProperty), minor code: 0
OpenGL vendor string:                   NVIDIA Corporation
OpenGL renderer string:                 GeForce GTX 1070/PCIe/SSE2
OpenGL version string:                  3.1.0 NVIDIA 387.34
OpenGL shading language version string: 1.40 NVIDIA via Cg compiler
Driver:                                 NVIDIA
Driver version:                         387.34
GPU class:                              Unknown
OpenGL version:                         3.1
GLSL version:                           1.40
X server version:                       1.19.5
Linux kernel version:                   4.14.8
Requires strict binding:                no
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
kpluginindex: Not cached "/home/altguard/.local/share/kwin/effects"
kpluginindex: Not cached "/usr/share/kwin/effects"
kf5.kcoreaddons.desktopparser: Property type "Url" is not a known QVariant type. Found while parsing property definition for "X-KWin-Video-Url" in "/usr/share/kservicetypes5/kwineffect.desktop"
kpluginindex: Not cached "/usr/local/share/kwin/effects"
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2090, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2092, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2100, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2110, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2111, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2112, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2113, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2114, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2115, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2116, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2117, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2120, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2121, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2122, resource id: 0, major code: 14 (GetGeometry), minor code: 0
QXcbConnection: XCB error: 9 (BadDrawable), sequence: 2123, resource id: 0, major code: 14 (GetGeometry), minor code: 0
kpluginindex: Not cached "/home/altguard/.local/share/kwin/scripts/"
kpluginindex: Not cached "/usr/share/kwin/scripts/"
kpluginindex: Not cached "/usr/local/share/kwin/scripts/"
===============================================================================

After screenshotting Chromium:

===============================================================================
The X11 connection broke (error 4). Did the X11 server die?
The X11 connection broke: Maximum allowed requested length exceeded (code 4)
XIO:  fatal IO error 2 (No such file or directory) on X server ":0"
      after 4871 requests (4871 known processed) with 0 events remaining.
$
===============================================================================
Comment 5 Martin Flöser 2017-12-25 10:42:54 UTC
From the video KWin is not (!) frozen. Compositing is active (we can see that when moving the konsole window) and rendering continues when entering the "frozen" state. As rendering is done in the main thread this means that KWin is not frozen.

To me it looks like something holds either a mouse, keyboard or X-Server grab.

Please use
xdotool key XF86LogGrabInfo

to print the active grabs to /var/log/Xorg.0.log
Comment 6 Christoph Feck 2018-01-10 21:01:01 UTC
If you can provide the information requested in comment #5, please add it.
Comment 7 Altguard 2018-01-12 10:07:15 UTC
Ah, my apologies. I forgot all about this after  the holidays. I'll attach the log now.
Comment 8 Altguard 2018-01-12 10:08:21 UTC
Created attachment 109814 [details]
Xorg log from  | xdotool key XF86LogGrabInfo
Comment 9 Martin Flöser 2018-01-12 15:27:09 UTC
There are no active grabs listed. Did you do this command when the problem was visible?
Comment 10 Altguard 2018-01-12 18:05:06 UTC
Ah, I didn't, sorry. However, I have now done it again while the problem was happening and there still weren't any active grabs listed (I'll attach the new log, but it's no different as far as I could see).
Comment 11 Altguard 2018-01-12 18:05:56 UTC
Created attachment 109821 [details]
Xorg log from  | xdotool key XF86LogGrabInfo
Comment 12 Martin Flöser 2018-01-12 18:15:58 UTC
Could you please post the output of:
qdbus org.kde.KWin /KWin supportInformation
Comment 13 Altguard 2018-01-12 23:45:26 UTC
I tried running that while the problem was active, and I got the output "Service 'org.kde.KWin' does not exist.", so the output I'm attaching was run while the problem was not active.
Comment 14 Altguard 2018-01-12 23:46:24 UTC
Created attachment 109827 [details]
Output of | qdbus org.kde.KWin /KWin supportInformation
Comment 15 Martin Flöser 2018-01-13 07:03:17 UTC
Could it be that it only breaks if you screenshot the larger screen or windows on that screen?
Comment 16 Altguard 2018-01-13 18:10:49 UTC
Interesting, apparently I can take an active window screenshot of Chromium on my smaller monitor without any problems. The issue only seems to happen on my larger main monitor, and it only happens with Chromium. Screenshots of any other application don't cause the issue, regardless of which monitor I take the screenshot on.
Comment 17 Martin Flöser 2018-01-13 19:03:39 UTC
I don't understand what it has to do with Chromium, but in general it seems to be just too much data to transfer in one X11 set property call.
Comment 18 Altguard 2018-01-13 20:51:34 UTC
That just gave me an idea I didn't consider before - resizing the windows. As it turns out, this isn't just Chromium - after trying multiple applications at different window sizes, it looks like taking a screenshot of *any* application past a certain window size causes the crash, and shrinking the chromium window down allows me to take a screenshot without issues. I always have Chromium windows open at a larger size than everything else, so I never caught on until now. My apologies.
Comment 19 Altguard 2018-01-13 21:18:41 UTC
In addition, taking a full screen screenshot of both monitors at once does not cause any issues - only the window screenshot.
Comment 20 Martin Flöser 2018-01-14 07:08:47 UTC
yeah, that all makes sense. Fullscreenshot is taken in a different way, thus the request problem is not hit.
Comment 21 Andrew Crouthamel 2018-03-06 05:10:59 UTC
*** Bug 391118 has been marked as a duplicate of this bug. ***
Comment 22 Andrew Crouthamel 2018-03-06 05:12:18 UTC
If anyone is interested, I have a bunch more information in Bug 391118. This bug is easily reproducible on my HiDPI laptop in X11 (but not Wayland).
Comment 23 Vlad Zahorodnii 2019-05-16 12:05:03 UTC
*** Bug 407373 has been marked as a duplicate of this bug. ***
Comment 24 Vlad Zahorodnii 2019-05-27 14:43:04 UTC
Git commit 67444e36592e78d46b757a6c72be1d50bdae19e6 by Vlad Zagorodniy.
Committed on 27/05/2019 at 14:30.
Pushed by vladz into branch 'Plasma/5.12'.

[effects/screenshot] Upload data to xpixmap in chunks

Summary:
xcb_put_image doesn't handle big images well. Contrary to XPutImage, the
caller must manually split the data in such a way that each xcb_put_image
request doesn't exceed the maximum request length. Not doing so will result
in libxcb shutting down the connection.
Related: bug 338489

Test Plan: Take a screenshot of an active fullscreen client on a 4K monitor.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D21370

M  +70   -10   effects/screenshot/screenshot.cpp

https://commits.kde.org/kwin/67444e36592e78d46b757a6c72be1d50bdae19e6
Comment 25 Vlad Zahorodnii 2019-05-27 14:46:02 UTC

*** This bug has been marked as a duplicate of bug 338489 ***