Summary: | On X11, various applications crash in QXcbBackingStoreImage::flushPixmap when screens change | ||
---|---|---|---|
Product: | [Plasma] kwin | Reporter: | tgpanaitescu |
Component: | general | Assignee: | KWin default assignee <kwin-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | barracha.afonso, bernhardu, biggestsonicfan, bruno, chenkolei, grivital, jsardid, junjun607, katonag, kcomain, marcin, me, miranda, nate, natemckay+kde, nekonexus, nicolas.fella, o.malek.cz, paolo, postix, roman, shtetldik, smitha, stakanov.s, traceydick, treacle, xaver.hugl |
Priority: | VHI | Keywords: | drkonqi |
Version: | 5.27.5 | ||
Target Milestone: | --- | ||
Platform: | Fedora RPMs | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/plasma/kwin/-/commit/437fba0f44eca82105a0c63df6d2521a1eb059c6 | Version Fixed In: | 5.27.11 |
Sentry Crash Report: | |||
Attachments: | New crash information added by DrKonqi |
Description
tgpanaitescu
2023-08-21 14:44:37 UTC
Hello, I receive this fault every now and then. I just found fullscreen processes crashing, therefore as a workaround it helps to not make windows fullscreen, instead leave it a little smaller. I received these crashes either when enabling or disabling one of my two screens, or when screens wakeup after energy saving. My setup are two screens of different brand, therefore maybe different reaction times. Different size but same resolution. The right screen is the main one, the left currently disabled. I report this issue some time ago in #461723 and brought this to the attention of Qt developers in https://bugreports.qt.io/browse/QTBUG-109226 . They fixed some flaw, but this issue unfortunately remained active. I found now again some time for a deeper look and found following before the crash: (with modified Qt library to output details of XCB_CONFIGURE_NOTIFY) > export QT_LOGGING_RULES=qt.qpa.*=true > gwenview picture.png > ... > qt.qpa.events: Event | XCB_CONFIGURE_NOTIFY(22) | sequence: 961 | 4-28-65528-65504 > qt.qpa.xcb: [ QWidgetWindow(0x556124696730, name="MainWindow#1Window") ] creating shared memory 17169384448 bytes for QSize(65528, 65504) depth 24 bits 32 > qt.qpa.xcb: xcb_shm_create_segment() can't be called for size 17169384448, maximumallowed size is 4294967295 > ... > 10 -- signal=11 > ... > KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi This huge resolution of 65528 width and 65504 height I could follow back to an event XCB_CONFIGURE_NOTIFY read from the X11 socket /tmp/.X11-unix/X0 in _xcb_in_read. I suspected this might originate from kwin_x11 - and there function X11Window::sendSyntheticConfigureNotify could fit. And below I found m_clientGeometry got negative values for width and heigth, which looks like it gets interpreted as a 16-bit unsigned int. (-32 == 0xffe0 == 65504). Should therefore this issue be reassigned to kwin? > Thread 1 hit Breakpoint 3, KWin::X11Window::sendSyntheticConfigureNotify (this=this@entry=0x557d9d033db0) at ./src/x11window.cpp:3791 > 3791 u.event.border_width = 0; > (rr) bt > #0 KWin::X11Window::sendSyntheticConfigureNotify() (this=this@entry=0x557d9d033db0) at ./src/x11window.cpp:3791 > #1 0x00007f9ffab7b961 in KWin::X11Window::updateServerGeometry() (this=this@entry=0x557d9d033db0) at ./src/x11window.cpp:4270 > #2 0x00007f9ffab7fdf9 in KWin::X11Window::moveResizeInternal(QRectF const&, KWin::Window::MoveResizeMode) (this=0x557d9d033db0, rect=<optimized out>, mode=KWin::Window::MoveResizeMode::MoveResize) at ./src/x11window.cpp:4215 > #3 0x00007f9ffaa8626c in KWin::PlacementTracker::restore(QString const&) (this=this@entry=0x7f9fd4011660, key=...) at ./src/placementtracker.cpp:110 > #4 0x00007f9ffab6165a in KWin::Workspace::desktopResized() (this=this@entry=0x557d95264b30) at ./src/workspace.cpp:2251 > ... > (rr) print this->m_clientGeometry > $5 = {xp = 4, yp = 28, w = -8, h = -32} > (rr) print u.event.width > $6 = 65528 > (rr) print u.event.height > $7 = 65504 > (rr) list > 3784 u.event.response_type = XCB_CONFIGURE_NOTIFY; > 3785 u.event.event = window(); > 3786 u.event.window = window(); > 3787 u.event.x = Xcb::toXNative(m_clientGeometry.x()); > 3788 u.event.y = Xcb::toXNative(m_clientGeometry.y()); > 3789 u.event.width = Xcb::toXNative(m_clientGeometry.width()); > 3790 u.event.height = Xcb::toXNative(m_clientGeometry.height()); > 3791 u.event.border_width = 0; > 3792 u.event.above_sibling = XCB_WINDOW_NONE; > 3793 u.event.override_redirect = 0; > 3794 xcb_send_event(kwinApp()->x11Connection(), true, c.event, XCB_EVENT_MASK_STRUCTURE_NOTIFY, reinterpret_cast<const char *>(&u)); I suspect #464967 and #463475 are open duplicates to this bug. Another small note: also non-Qt applications like gitk are sometimes affected and crash with an X error. Created attachment 161340 [details]
New crash information added by DrKonqi
konsole (23.04.3) using Qt 5.15.10
crash after switch KVM
-- Backtrace (Reduced):
#4 __memcpy_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:265
#5 0x00007fd9393c14c8 in memmove (__len=262096, __src=0x7fd472270fb0, __dest=0x7fd9042f0fc8) at /usr/include/bits/string_fortified.h:36
#6 copy_unswapped (dst=0x7fd9042f0fc8 "", dstBytesPerLine=dstBytesPerLine@entry=262096, img=..., rect=...) at /var/tmp/portage/dev-qt/qtgui-5.15.10-r1/work/qtbase-everywhere-src-5.15.10/src/plugins/platforms/xcb/qxcbbackingstore.cpp:547
#7 0x00007fd9393c1661 in native_sub_image (buffer=buffer@entry=0x5558e2311160, dstStride=dstStride@entry=262096, src=..., rect=..., swap=swap@entry=false) at /var/tmp/portage/dev-qt/qtgui-5.15.10-r1/work/qtbase-everywhere-src-5.15.10/src/plugins/platforms/xcb/qxcbbackingstore.cpp:590
#8 0x00007fd9393c3008 in QXcbBackingStoreImage::flushPixmap (this=this@entry=0x5558e23110e0, region=..., fullRegion=fullRegion@entry=true) at /var/tmp/portage/dev-qt/qtgui-5.15.10-r1/work/qtbase-everywhere-src-5.15.10/src/plugins/platforms/xcb/qxcbbackingstore.cpp:669
Hello, I hope it is ok to change this bug to kwin.
Bottom line is:
kwin_x11 creates from this geometry {xp = 4, yp = 28, w = -8, h = -32} an event with dimensions 65528 x 65504.
Would following modification be acceptable?
> --- kwin-5.27.5.orig/src/x11window.cpp
> +++ kwin-5.27.5/src/x11window.cpp
> @@ -3786,8 +3786,8 @@ void X11Window::sendSyntheticConfigureNo
> - u.event.width = Xcb::toXNative(m_clientGeometry.width());
> - u.event.height = Xcb::toXNative(m_clientGeometry.height());
> + u.event.width = Xcb::toXNative(std::max(0.0, m_clientGeometry.width()));
> + u.event.height = Xcb::toXNative(std::max(0.0, m_clientGeometry.height()));
That makes sense to me. Please feel free to submit it as a merge request! A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4388 *** Bug 475204 has been marked as a duplicate of this bug. *** *** Bug 463475 has been marked as a duplicate of this bug. *** *** Bug 467191 has been marked as a duplicate of this bug. *** *** Bug 467010 has been marked as a duplicate of this bug. *** *** Bug 451110 has been marked as a duplicate of this bug. *** *** Bug 462022 has been marked as a duplicate of this bug. *** *** Bug 462487 has been marked as a duplicate of this bug. *** *** Bug 466503 has been marked as a duplicate of this bug. *** *** Bug 470450 has been marked as a duplicate of this bug. *** *** Bug 473405 has been marked as a duplicate of this bug. *** *** Bug 461723 has been marked as a duplicate of this bug. *** *** Bug 474171 has been marked as a duplicate of this bug. *** *** Bug 461563 has been marked as a duplicate of this bug. *** *** Bug 474088 has been marked as a duplicate of this bug. *** *** Bug 464967 has been marked as a duplicate of this bug. *** *** Bug 474311 has been marked as a duplicate of this bug. *** *** Bug 474720 has been marked as a duplicate of this bug. *** *** Bug 474128 has been marked as a duplicate of this bug. *** *** Bug 465077 has been marked as a duplicate of this bug. *** *** Bug 465146 has been marked as a duplicate of this bug. *** *** Bug 467419 has been marked as a duplicate of this bug. *** *** Bug 469264 has been marked as a duplicate of this bug. *** This just happened to me on kwin_wayland as well, with gwenview 23.08.2, qt5-base 5.15.11+kde+r138, on Arch Linux A possibly relevant merge request was started @ https://invent.kde.org/plasma/kwin/-/merge_requests/4590 Crash report for dolphin using kwin_wayland 5.27.9 on Arch Linux, qt5-base 5.15.11+kde+r138 (on nvidia) Application: Dolphin (dolphin), signal: Segmentation fault Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = <optimized out>} [KCrash Handler] #6 __memcpy_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:265 #7 0x00007f4369b2757b in memmove (__len=262112, __src=0x7f3e998be810, __dest=<optimized out>) at /usr/include/bits/string_fortified.h:36 #8 copy_unswapped (rect=<synthetic pointer>..., img=..., dstBytesPerLine=262112, dst=<optimized out>) at /usr/src/debug/qt5-base/qtbase/src/plugins/platforms/xcb/qxcbbackingstore.cpp:547 #9 native_sub_image (swap=false, rect=<synthetic pointer>..., src=<optimized out>, dstStride=262112, buffer=<optimized out>) at /usr/src/debug/qt5-base/qtbase/src/plugins/platforms/xcb/qxcbbackingstore.cpp:590 #10 QXcbBackingStoreImage::flushPixmap(QRegion const&, bool) (this=this@entry=0x55dc979bbaf0, region=..., fullRegion=<optimized out>) at /usr/src/debug/qt5-base/qtbase/src/plugins/platforms/xcb/qxcbbackingstore.cpp:669 #11 0x00007f4369b278d3 in QXcbBackingStoreImage::flushPixmap(QRegion const&, bool) (fullRegion=<optimized out>, this=this@entry=0x55dc979bbaf0, region=..., fullRegion=fullRegion@entry=true) at /usr/src/debug/qt5-base/qtbase/src/plugins/platforms/xcb/qxcbbackingstore.cpp:690 #12 0x00007f4369b27b37 in QXcbBackingStoreImage::flushPixmap(QRegion const&, bool) (fullRegion=false, region=..., this=0x55dc979bbaf0) at /usr/src/debug/qt5-base/qtbase/src/plugins/platforms/xcb/qxcbbackingstore.cpp:627 #13 QXcbBackingStoreImage::put(unsigned int, QRegion const&, QPoint const&) (this=0x55dc979bbaf0, dst=20971532, region=..., offset=<optimized out>) at /usr/src/debug/qt5-base/qtbase/src/plugins/platforms/xcb/qxcbbackingstore.cpp:741 #14 0x00007f4369b2848e in QXcbBackingStore::flush(QWindow*, QRegion const&, QPoint const&) (this=0x55dc96d107d0, window=<optimized out>, region=<optimized out>, offset=...) at /usr/src/debug/qt5-base/qtbase/src/plugins/platforms/xcb/qxcbbackingstore.cpp:877 #15 0x00007f43700ea5f7 in QBackingStore::flush(QRegion const&, QWindow*, QPoint const&) (this=this@entry=0x7f435c0024a0, region=..., window=0x55dc96ed7b90, offset=...) at painting/qbackingstore.cpp:263 #16 0x00007f4370782a91 in QWidgetRepaintManager::flush(QWidget*, QRegion const&, QPlatformTextureList*) (this=this@entry=0x55dc96da8c80, widget=0x55dc96831a40, region=..., widgetTextures=<optimized out>) at kernel/qwidgetrepaintmanager.cpp:1198 #17 0x00007f4370782fe5 in QWidgetRepaintManager::flush() (this=this@entry=0x55dc96da8c80) at kernel/qwidgetrepaintmanager.cpp:1096 #18 0x00007f43707846ed in QWidgetRepaintManager::paintAndFlush() (this=0x55dc96da8c80) at kernel/qwidgetrepaintmanager.cpp:1028 #19 0x00007f43707d0a20 in QWidgetWindow::handleResizeEvent(QResizeEvent*) (event=0x7ffd226c1580, this=0x55dc96ed7b90) at kernel/qwidgetwindow.cpp:842 #20 QWidgetWindow::event(QEvent*) (this=0x55dc96ed7b90, event=0x7ffd226c1580) at kernel/qwidgetwindow.cpp:322 #21 0x00007f43707788ff in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x55dc96ed7b90, e=0x7ffd226c1580) at kernel/qapplication.cpp:3640 #22 0x00007f436fa9c168 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55dc96ed7b90, event=0x7ffd226c1580) at kernel/qcoreapplication.cpp:1064 #23 0x00007f436fa9c1f3 in QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474 #24 0x00007f436ff45996 in QGuiApplicationPrivate::processGeometryChangeEvent(QWindowSystemInterfacePrivate::GeometryChangeEvent*) (e=<optimized out>) at kernel/qguiapplication.cpp:2610 #25 0x00007f436ff2a6e5 in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169 #26 0x00007f4369b2f5e0 in xcbSourceDispatch(GSource*, GSourceFunc, gpointer) (source=<optimized out>) at /usr/src/debug/qt5-base/qtbase/src/plugins/platforms/xcb/qxcbeventdispatcher.cpp:105 #27 0x00007f436d90df69 in g_main_dispatch (context=0x7f4364000ec0) at ../glib/glib/gmain.c:3476 #28 0x00007f436d96c327 in g_main_context_dispatch_unlocked (context=0x7f4364000ec0) at ../glib/glib/gmain.c:4284 #29 g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7f4364000ec0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/glib/gmain.c:4349 #30 0x00007f436d90c162 in g_main_context_iteration (context=0x7f4364000ec0, may_block=1) at ../glib/glib/gmain.c:4414 #31 0x00007f436faeaf7c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55dc963f2850, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #32 0x00007f436fa9ae74 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffd226c1870, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69 #33 0x00007f436fa9c313 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121 #34 0x00007f436ff3bf02 in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1870 #35 0x00007f4370776cda in QApplication::exec() () at kernel/qapplication.cpp:2832 #36 0x000055dc95aa7db8 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/dolphin/dolphin-23.08.2/src/main.cpp:255 [Inferior 1 (process 4182) detached] *** Bug 478678 has been marked as a duplicate of this bug. *** *** Bug 480591 has been marked as a duplicate of this bug. *** *** Bug 481050 has been marked as a duplicate of this bug. *** *** Bug 481332 has been marked as a duplicate of this bug. *** Git commit 86db3b43364cd60503e37b91437e0bc25ddfc40d by Xaver Hugl. Committed on 19/02/2024 at 16:18. Pushed by zamundaaa into branch 'master'. placementtracker: don't set geometry to geometry restores It can cause problems when the geometry restore value is invalid M +6 -13 src/placementtracker.cpp M +2 -2 src/window.h https://invent.kde.org/plasma/kwin/-/commit/86db3b43364cd60503e37b91437e0bc25ddfc40d Git commit e9004f723a72b6df09ae14c2936a4c209849e367 by Xaver Hugl. Committed on 19/02/2024 at 16:30. Pushed by zamundaaa into branch 'Plasma/6.0'. placementtracker: don't set geometry to geometry restores It can cause problems when the geometry restore value is invalid (cherry picked from commit 86db3b43364cd60503e37b91437e0bc25ddfc40d) M +6 -13 src/placementtracker.cpp M +2 -2 src/window.h https://invent.kde.org/plasma/kwin/-/commit/e9004f723a72b6df09ae14c2936a4c209849e367 Git commit 437fba0f44eca82105a0c63df6d2521a1eb059c6 by Xaver Hugl. Committed on 19/02/2024 at 21:24. Pushed by zamundaaa into branch 'Plasma/5.27'. placementtracker: don't set geometry to geometry restores It can cause problems when the geometry restore value is invalid (cherry picked from commit 86db3b43364cd60503e37b91437e0bc25ddfc40d) M +6 -13 src/placementtracker.cpp M +1 -1 src/window.h https://invent.kde.org/plasma/kwin/-/commit/437fba0f44eca82105a0c63df6d2521a1eb059c6 |