Bug 419749 - Crash on Wayland when I switched to "Extend to left" multi-monitor mode
Summary: Crash on Wayland when I switched to "Extend to left" multi-monitor mode
Status: RESOLVED FIXED
Alias: None
Product: Powerdevil
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: wayland
: 419761 419762 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-04-06 18:27 UTC by Patrick Silva
Modified: 2020-05-26 15:19 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.19


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2020-04-06 18:27:37 UTC
Application: org_kde_powerdevil (2.0.0)

Qt Version: 5.14.1
Frameworks Version: 5.69.0
Operating System: Linux 5.3.0-45-generic x86_64
Windowing system: Wayland
Distribution: KDE neon Unstable Edition

-- Information about the crash:
- What I was doing when the application crashed:
I was using Wayland session with an external monitor conneced to hdmi port, then I switched from "Swith to external monitor"
to "Extend to left" multi-monitor mode and plasma shown 4 crash notifications at the same: time: discover notifier, kactivitymanagerd, policykit kde agent and this one.

-- Backtrace:
Application: KDE Power Management System (org_kde_powerdevil), signal: Segmentation fault
Content of s_kcrashErrorMessage: [Current thread is 1 (Thread 0x7f62e0dc1c80 (LWP 1233))]
[KCrash Handler]
#7  0x00007f62d115eca9 in QtWayland::wl_output::handle_geometry(void*, wl_output*, int, int, int, int, int, char const*, char const*, int) (data=0x55e20ba081e0, object=0x55e20ba08280, x=1920, y=0, physical_width=310, physical_height=170, subpixel=0, make=0x7f62b8009780 "LG Display", model=0x7f62b8009790 "LVDS-1-desconhecido", transform=0) at qwayland-wayland.cpp:2212
#8  0x00007f62d0637dae in ffi_call_unix64 () at /usr/lib/x86_64-linux-gnu/libffi.so.6
#9  0x00007f62d063771f in ffi_call () at /usr/lib/x86_64-linux-gnu/libffi.so.6
#10 0x00007f62d0cc6e24 in wl_closure_invoke (closure=closure@entry=0x7f62b8009690, flags=flags@entry=1, target=<optimized out>, target@entry=0x55e20ba08280, opcode=opcode@entry=0, data=<optimized out>) at ../src/connection.c:1006
#11 0x00007f62d0cc3659 in dispatch_event (display=display@entry=0x55e20ba00b50, queue=<optimized out>) at ../src/wayland-client.c:1427
#12 0x00007f62d0cc4b24 in dispatch_queue (queue=0x55e20ba00c18, display=0x55e20ba00b50) at ../src/wayland-client.c:1573
#13 0x00007f62d0cc4b24 in wl_display_dispatch_queue_pending (display=0x55e20ba00b50, queue=0x55e20ba00c18) at ../src/wayland-client.c:1815
#14 0x00007f62d0cc4b7c in wl_display_dispatch_pending (display=<optimized out>) at ../src/wayland-client.c:1878
#15 0x00007f62d113b642 in QtWaylandClient::QWaylandDisplay::flushRequests() (this=0x55e20ba009b0) at qwaylanddisplay.cpp:208
#16 0x00007f62de171dc9 in doActivate<false>(QObject*, int, void**) (sender=0x55e20ba2d4a0, signal_index=3, argv=0x7fff37af0670) at kernel/qobject.cpp:3882
#17 0x00007f62de16c8a2 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x55e20ba2d4a0, m=m@entry=0x7f62de604bc0 <QSocketNotifier::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fff37af0670) at kernel/qobject.cpp:3930
#18 0x00007f62de1755c8 in QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal) (this=this@entry=0x55e20ba2d4a0, _t1=<optimized out>, _t2=...) at .moc/moc_qsocketnotifier.cpp:141
#19 0x00007f62de175982 in QSocketNotifier::event(QEvent*) (this=0x55e20ba2d4a0, e=0x7fff37af0750) at kernel/qsocketnotifier.cpp:266
#20 0x00007f62de136db8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55e20ba2d4a0, event=0x7fff37af0750) at kernel/qcoreapplication.cpp:1092
#21 0x00007f62de136f8e in QCoreApplication::sendEvent(QObject*, QEvent*) (receiver=<optimized out>, event=event@entry=0x7fff37af0750) at kernel/qcoreapplication.cpp:1487
#22 0x00007f62de196c88 in socketNotifierSourceDispatch(GSource*, GSourceFunc, gpointer) (source=0x55e20ba5edd0) at kernel/qeventdispatcher_glib.cpp:107
#23 0x00007f62d881d417 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007f62d881d650 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007f62d881d6dc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007f62de1960bc in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55e20ba0f850, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#27 0x00007f62de13563a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7fff37af0970, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225
#28 0x00007f62de13edb0 in QCoreApplication::exec() () at kernel/qcoreapplication.cpp:1400
#29 0x000055e209f007ff in  ()
#30 0x00007f62dd73cb97 in __libc_start_main (main=0x55e209f00640, argc=1, argv=0x7fff37af0b68, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff37af0b58) at ../csu/libc-start.c:310
#31 0x000055e209f0086a in _start ()

Possible duplicates by query: bug 391109, bug 386166, bug 377347, bug 377346, bug 376678.

Reported using DrKonqi
Comment 1 David Edmundson 2020-04-06 21:04:20 UTC
*** Bug 419762 has been marked as a duplicate of this bug. ***
Comment 2 David Edmundson 2020-04-06 21:05:29 UTC
*** Bug 419761 has been marked as a duplicate of this bug. ***
Comment 3 David Edmundson 2020-04-06 21:39:49 UTC
Reproduced
Comment 4 Méven Car 2020-04-20 16:45:55 UTC
Reproduced as well.

Have two screens setup.
Disable a screen, a qt app crashes (saw this with drkonqi, or plasmashell)

#6  0x00007f3499ee95ea in std::__atomic_base<QtSharedPointer::ExternalRefCountData*>::load (__m=std::memory_order_relaxed, this=<optimized out>) at /usr/include/c++/7/bits/atomic_base.h:713
#7  std::atomic<QtSharedPointer::ExternalRefCountData*>::load (__m=std::memory_order_relaxed, this=<optimized out>) at /usr/include/c++/7/atomic:452
#8  QAtomicOps<QtSharedPointer::ExternalRefCountData*>::loadRelaxed<QtSharedPointer::ExternalRefCountData*> (_q_value=...) at ../../include/QtCore/../../src/corelib/thread/qatomic_cxx11.h:239
#9  QBasicAtomicPointer<QtSharedPointer::ExternalRefCountData>::loadRelaxed (this=<optimized out>) at ../../include/QtCore/../../src/corelib/thread/qbasicatomic.h:248
#10 QtSharedPointer::ExternalRefCountData::getAndRef (obj=0x564ac1f8d470) at tools/qsharedpointer.cpp:1395
#11 0x00007f349a67187d in void QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::DefaultDelivery>(QWindow*, QScreen*) () from /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#12 0x00007f348ff636b7 in QtWaylandClient::QWaylandWindow::handleScreensChanged (this=0x564ac20fa800) at qwaylandwindow.cpp:969
#13 0x00007f349a0cffe7 in QtPrivate::QSlotObjectBase::call (a=0x7fffc4bbc960, r=0x564ac20fa800, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:394
#14 doActivate<false> (sender=0x564ac20f8670, signal_index=3, argv=0x7fffc4bbc960) at kernel/qobject.cpp:3870
#15 0x00007f349a0ca8a2 in QMetaObject::activate (sender=sender@entry=0x564ac20f8670, m=m@entry=0x7f3490221d20 <QtWaylandClient::QWaylandSurface::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3930
#16 0x00007f348ff81840 in QtWaylandClient::QWaylandSurface::screensChanged (this=this@entry=0x564ac20f8670) at .moc/moc_qwaylandsurface_p.cpp:155
#17 0x00007f348ff697a4 in QtWaylandClient::QWaylandSurface::surface_enter (this=0x564ac20f8670, output=0x564ac2134df0) at qwaylandsurface.cpp:97
#18 0x00007f348f457dae in ffi_call_unix64 () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#19 0x00007f348f45771f in ffi_call () from /usr/lib/x86_64-linux-gnu/libffi.so.6
#20 0x00007f348fae6e24 in ?? () from /usr/lib/x86_64-linux-gnu/libwayland-client.so.0
#21 0x00007f348fae3659 in ?? () from /usr/lib/x86_64-linux-gnu/libwayland-client.so.0
#22 0x00007f348fae4b24 in wl_display_dispatch_queue_pending () from /usr/lib/x86_64-linux-gnu/libwayland-client.so.0
#23 0x00007f348ff5b642 in QtWaylandClient::QWaylandDisplay::flushRequests (this=0x564ac1abb0f0) at qwaylanddisplay.cpp:208
#24 0x00007f349a0cfdc9 in doActivate<false> (sender=0x564ac1b2a390, signal_index=3, argv=0x7fffc4bbcef0) at kernel/qobject.cpp:3882
#25 0x00007f349a0ca8a2 in QMetaObject::activate (sender=sender@entry=0x564ac1b2a390, m=m@entry=0x7f349a562bc0 <QSocketNotifier::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffc4bbcef0) at kernel/qobject.cpp:3930
#26 0x00007f349a0d35c8 in QSocketNotifier::activated (this=this@entry=0x564ac1b2a390, _t1=<optimized out>, _t2=...) at .moc/moc_qsocketnotifier.cpp:141
#27 0x00007f349a0d3982 in QSocketNotifier::event (this=0x564ac1b2a390, e=0x7fffc4bbd1c0) at kernel/qsocketnotifier.cpp:266
#28 0x00007f349b4af8bc in QApplicationPrivate::notify_helper (this=this@entry=0x564ac1ab0c30, receiver=receiver@entry=0x564ac1b2a390, e=e@entry=0x7fffc4bbd1c0) at kernel/qapplication.cpp:3684
#29 0x00007f349b4b6ac0 in QApplication::notify (this=0x7fffc4bbd5d0, receiver=0x564ac1b2a390, e=0x7fffc4bbd1c0) at kernel/qapplication.cpp:3430
Comment 5 David Edmundson 2020-04-20 16:58:29 UTC
We should make this a priority as we don't have a lot of time before Qt 5.15 is out.
Comment 6 Méven Car 2020-04-21 07:41:58 UTC
Reported to Qt: https://bugreports.qt.io/browse/QTBUG-83674
Comment 7 Christoph Feck 2020-04-21 08:23:54 UTC
Comment 4 is bug 419492.
Comment 8 David Edmundson 2020-05-05 14:49:47 UTC
There's a chance this is surfaced by my 80d3f148e0a77f1e38dd2b79c7747e37ac67a5ed

*if* kwayland called destroy() then setGeometry()  before create()  the receiving Qt client would delete the QWaylandScreen object, release their resource, but then process an event dispatched to their now deleted proxy object, that sequence of events would match the backtrace.

If you can reproduce reliably we could put debug in KWaylandServer to make sure our global is valid when sending any output events?

If that's the case it can be guarded on the client by but really we should just fix kwin sending such events.
Comment 9 Méven Car 2020-05-26 15:14:15 UTC
Git commit 797ccca48cacd86393945608b9e56771ae389b2e by Méven Car.
Committed on 26/05/2020 at 15:14.
Pushed by meven into branch 'master'.

Wayland: avoid binding disabled outputs to surfaces

We don't need to bind disabled outputs to surfaces that overlaps them.
This prevents error down the line and warnings about ignoring surface.enter events with Qt.

M  +2    -0    plugins/platforms/drm/drm_output.cpp
M  +6    -4    xdgshellclient.cpp

https://invent.kde.org/plasma/kwin/commit/797ccca48cacd86393945608b9e56771ae389b2e
Comment 10 Méven Car 2020-05-26 15:18:16 UTC
Git commit f0f465ccbd80bda17d66b53e2df5d886be0ec664 by Méven Car.
Committed on 26/05/2020 at 15:18.
Pushed by meven into branch 'Plasma/5.19'.

Wayland: avoid binding disabled outputs to surfaces

We don't need to bind disabled outputs to surfaces that overlaps them.
This prevents error down the line and warnings about ignoring surface.enter events with Qt.

M  +2    -0    plugins/platforms/drm/drm_output.cpp
M  +6    -4    xdgshellclient.cpp

https://invent.kde.org/plasma/kwin/commit/f0f465ccbd80bda17d66b53e2df5d886be0ec664