Bug 439208

Summary: kwin_wayland crashes, killing the whole session, when laptop is docked
Product: [Plasma] kwin Reporter: Markus Knetschke <markus.knetschke>
Component: wayland-genericAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: crash CC: kde, kdedev
Priority: NOR    
Version: 5.22.2   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Markus Knetschke 2021-06-27 08:51:35 UTC
SUMMARY
Every time I dock my laptop (which attaches two monitors) kwin_wayland crashes bringing the whole session down.

STEPS TO REPRODUCE
1. Dock the laptop
2. <Crash>

OBSERVED RESULT
kwin_wayland crashes

EXPECTED RESULT
kwin_wayland does not crash


SOFTWARE/OS VERSIONS
Operating System: Gentoo Linux
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.12-gentoo-dist (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i7-7600U CPU @ 2.80GHz
Memory: 22.9 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 620

ADDITIONAL INFORMATION
kwin_wayland tells me it's version 5.22.1 but I made sure it's 5.22.2. The commit https://github.com/KDE/kwin/commit/1b085637eb3bd2ee4b9fab6a5564c69c5ceab76a  which changed the version isn't in the history of the 5.22.2 tag https://github.com/KDE/kwin/commits/v5.22.2

Backtrace:
[Current thread is 1 (Thread 0x7fb5669a7ec0 (LWP 924))]
#0  0x00007fb565716cb1 in KWin::DrmConnector::DrmConnector(KWin::DrmGpu*, unsigned int) (this=this@entry=0x56375c5197e0, gpu=gpu@entry=0x56375a52adb0, connectorId=connectorId@entry=152) at /var/tmp/portage/kde-plasma/kwin-5.22.2/work/kwin-5.22.2/src/plugins/platforms/drm/drm_object_connector.cpp:25
        i = 0
#1  0x00007fb565726677 in KWin::DrmGpu::updateOutputs() (this=this@entry=0x56375a52adb0) at /var/tmp/portage/kde-plasma/kwin-5.22.2/work/kwin-5.22.2/src/plugins/platforms/drm/drm_gpu.cpp:161
        c = 0x56375bf57a20
        currentConnector = 152
        it = <optimized out>
        i = 9
        oldConnectors = {d = 0x56375cbf4fa0}
        oldCrtcs = {d = 0x56375a534600}
        resources = {d = 0x56375c2b7e70}
        connectedOutputs = {d = 0x7fb56c94ef5c <QUtf8::convertToUnicode(char const*, int, QTextCodec::ConverterState*)+748>}
        pendingConnectors = {d = 0x0}
        removedOutputs = {d = 0x56375b88d470}
        it = <optimized out>
#2  0x00007fb565710a10 in KWin::DrmBackend::updateOutputs() (this=0x56375a51fac0) at /var/tmp/portage/kde-plasma/kwin-5.22.2/work/kwin-5.22.2/src/plugins/platforms/drm/drm_backend.cpp:341
        gpu = 0x56375a52adb0
        it = 0x56375a531b28
        oldOutputs = {d = <optimized out>}
#3  KWin::DrmBackend::updateOutputs() (this=0x56375a51fac0) at /var/tmp/portage/kde-plasma/kwin-5.22.2/work/kwin-5.22.2/src/plugins/platforms/drm/drm_backend.cpp:333
#4  0x00007fb565712a29 in KWin::DrmBackend::handleUdevEvent() (this=0x56375a51fac0) at /var/tmp/portage/kde-plasma/kwin-5.22.2/work/kwin-5.22.2/src/plugins/platforms/drm/drm_backend.cpp:260
        gpu = <optimized out>
        device = std::unique_ptr<KWin::UdevDevice> = {get() = 0x56375c1a4280}
#5  0x00007fb56c92c5fe in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffe34467d10, r=0x56375a51fac0, this=0x56375a537870) at /var/tmp/portage/dev-qt/qtcore-5.15.2-r2/work/qtbase-everywhere-src-5.15.2/include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
        obj = std::unique_ptr<QtPrivate::QSlotObjectBase> = {get() = 0x56375a537870}
        receiver = 0x56375a51fac0
        td = <optimized out>
        receiverInSameThread = <optimized out>
        senderData = {previous = 0x0, receiver = 0x56375a51fac0, sender = 0x56375a52bc10, signal = 3}
        c = 0x56375a52aea0
        connections = {d = 0x56375a5378a0}
        list = <optimized out>
        inSenderThread = true
        highestConnectionId = 1
        signalVector = 0x56375a52d730
        currentThreadId = 0x7fb5669a7ec0
        sp = <optimized out>
        signal_spy_set = 0x0
        empty_argv = {0x0}
        senderDeleted = false
#6  doActivate<false>(QObject*, int, void**) (sender=0x56375a52bc10, signal_index=3, argv=0x7ffe34467d10) at /var/tmp/portage/dev-qt/qtcore-5.15.2-r2/work/qtbase-everywhere-src-5.15.2/src/corelib/kernel/qobject.cpp:3886
        obj = std::unique_ptr<QtPrivate::QSlotObjectBase> = {get() = 0x56375a537870}
        receiver = 0x56375a51fac0
        td = <optimized out>
        receiverInSameThread = <optimized out>
        senderData = {previous = 0x0, receiver = 0x56375a51fac0, sender = 0x56375a52bc10, signal = 3}
        c = 0x56375a52aea0
        connections = {d = 0x56375a5378a0}
        list = <optimized out>
        inSenderThread = true
        highestConnectionId = 1
        signalVector = 0x56375a52d730
        currentThreadId = 0x7fb5669a7ec0
        sp = <optimized out>
        signal_spy_set = 0x0
        empty_argv = {0x0}
        senderDeleted = false
#7  0x00007fb56c92661f in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x56375a52bc10, m=m@entry=0x7fb56cbc11a0 <QSocketNotifier::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffe34467d10) at /var/tmp/portage/dev-qt/qtcore-5.15.2-r2/work/qtbase-everywhere-src-5.15.2/src/corelib/kernel/qobject.cpp:3946
#8  0x00007fb56c92fb16 in QSocketNotifier::activated(QSocketDescriptor, QSocketNotifier::Type, QSocketNotifier::QPrivateSignal) (this=this@entry=0x56375a52bc10, _t1=..., _t2=<optimized out>, _t3=...) at .moc/moc_qsocketnotifier.cpp:178
        _a = {0x0, 0x7ffe34467d0c, 0x7ffe34467d08, 0x7ffe34467d07}
#9  0x00007fb56c93030b in QSocketNotifier::event(QEvent*) (this=0x56375a52bc10, e=0x7ffe34467fd0) at /var/tmp/portage/dev-qt/qtcore-5.15.2-r2/work/qtbase-everywhere-src-5.15.2/src/corelib/kernel/qsocketnotifier.cpp:302
        d = 0x56375a536270
#10 0x00007fb56d4a1d8f in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#11 0x00007fb56d4aaa40 in QApplication::notify(QObject*, QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#12 0x00007fb56c8fa108 in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x56375a52bc10, event=0x7ffe34467fd0) at /var/tmp/portage/dev-qt/qtcore-5.15.2-r2/work/qtbase-everywhere-src-5.15.2/src/corelib/kernel/qcoreapplication.cpp:1063
        selfRequired = true
        result = false
        cbdata = {0x56375a52bc10, 0x7ffe34467fd0, 0x7ffe34467f7f}
        d = <optimized out>
        threadData = 0x56375a498580
        scopeLevelCounter = {threadData = 0x56375a498580}
#13 0x00007fb56c94788e in QEventDispatcherUNIXPrivate::activateSocketNotifiers() (this=0x56375a4c5d90) at /var/tmp/portage/dev-qt/qtcore-5.15.2-r2/work/qtbase-everywhere-src-5.15.2/src/corelib/kernel/qeventdispatcher_unix.cpp:304
        notifier = 0x56375a52bc10
        n_activated = 0
        event = {_vptr.QEvent = 0x7fb56cbc0b10 <vtable for QEvent+16>, static staticMetaObject = {d = {superdata = {direct = 0x0}, stringdata = 0x7fb56caa1b00 <qt_meta_stringdata_QEvent>, data = 0x7fb56caa1540 <qt_meta_data_QEvent>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}, d = 0x0, t = 50, posted = 0, spont = 0, m_accept = 1, reserved = 1672}
#14 0x00007fb56c947c14 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=<optimized out>, flags=...) at /var/tmp/portage/dev-qt/qtcore-5.15.2-r2/work/qtbase-everywhere-src-5.15.2/src/corelib/kernel/qeventdispatcher_unix.cpp:511
        d = 0x56375a4c5d90
        threadData = <optimized out>
        include_timers = true
        canWait = <optimized out>
        tm = <optimized out>
        wait_tm = {tv_sec = 5, tv_nsec = 436000000}
        nevents = 0
#15 0x00005637595efcbd in QUnixEventDispatcherQPA::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
#16 0x00007fb56c8f8ba3 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffe34468140, flags=..., flags@entry=...) at /var/tmp/portage/dev-qt/qtcore-5.15.2-r2/work/qtbase-everywhere-src-5.15.2/include/QtCore/../../src/corelib/global/qflags.h:69
        d = 0x56375a57de90
        threadData = <optimized out>
        locker = {val = 94795738055928}
        app = <optimized out>
#17 0x00007fb56c900eb0 in QCoreApplication::exec() () at /var/tmp/portage/dev-qt/qtcore-5.15.2-r2/work/qtbase-everywhere-src-5.15.2/include/QtCore/../../src/corelib/global/qflags.h:121
        threadData = 0x56375a498580
        eventLoop = {<QObject> = {_vptr.QObject = 0x7fb56cbc08c8 <vtable for QEventLoop+16>, static staticMetaObject = {d = {superdata = {direct = 0x0}, stringdata = 0x7fb56caa61c0 <qt_meta_stringdata_QObject>, data = 0x7fb56caa60a0 <qt_meta_data_QObject>, static_metacall = 0x7fb56c92aa30 <QObject::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0x56375a57de90}, static staticQtMetaObject = {d = {superdata = {direct = 0x0}, stringdata = 0x7fb56caa9160 <qt_meta_stringdata_Qt>, data = 0x7fb56caa62e0 <qt_meta_data_Qt>, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = {direct = 0x7fb56cbb81c0 <QObject::staticMetaObject>}, stringdata = 0x7fb56caa09a0 <qt_meta_stringdata_QEventLoop>, data = 0x7fb56caa0940 <qt_meta_data_QEventLoop>, static_metacall = 0x7fb56c8f88f0 <QEventLoop::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}
        returnCode = <optimized out>
#18 0x0000563759599dc9 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at /var/tmp/portage/kde-plasma/kwin-5.22.2/work/kwin-5.22.2/src/main_wayland.cpp:727
        userSignals = {__val = {2560, 94795722739592, 140417179364904, 140417177816512, 0, 94795722378528, 94795722738896, 140417177816658, 5, 94795722378528, 94795722738896, 140417177816658, 5, 6, 5, 140729775457880}}
        environment = {d = {d = 0x56375a4bef90}}
        a = {<KWin::ApplicationWaylandAbstract> = {<KWin::Application> = {<QApplication> = {<No data fields>}, static staticMetaObject = {d = {superdata = {direct = 0x7fb56d9a2fc0 <QApplication::staticMetaObject>}, stringdata = 0x7fb56e3a14a0 <qt_meta_stringdata_KWin__Application>, data = 0x7fb56e3a1340 <qt_meta_data_KWin__Application>, static_metacall = 0x7fb56e1b4860 <KWin::Application::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, m_eventFilters = {<QListSpecialMethods<QPointer<KWin::X11EventFilterContainer> >> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, static is_always_lock_free = true}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x56375b11f880}, d = 0x56375b11f880}}, m_genericEventFilters = {<QListSpecialMethods<QPointer<KWin::X11EventFilterContainer> >> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, static is_always_lock_free = true}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7fb56c9c5510 <QListData::shared_null>}, d = 0x7fb56c9c5510 <QListData::shared_null>}}, m_eventFilter = {d = 0x56375a4ed780}, m_configLock = false, m_config = {d = 0x56375a4e2080}, m_kxkbConfig = {d = 0x56375a521960}, m_operationMode = KWin::Application::OperationModeXwayland, m_x11Time = 34594453, m_rootWindow = 703, m_connection = 0x56375b64e8e0, m_defaultScreen = 0x56375b653c14, m_useKActivities = true, m_platform = 0x56375a51fac0, m_terminating = false, m_isClosingX11Connection = false}, static staticMetaObject = {d = {superdata = {direct = 0x7fb56e44fc20 <KWin::Application::staticMetaObject>}, stringdata = 0x7fb56e3a1300 <qt_meta_stringdata_KWin__ApplicationWaylandAbstract>, data = 0x7fb56e3a12c0 <qt_meta_data_KWin__ApplicationWaylandAbstract>, static_metacall = 0x7fb56e1b2880 <KWin::ApplicationWaylandAbstract::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}}, static staticMetaObject = {d = {superdata = {direct = 0x7fb56e44fbe0 <KWin::ApplicationWaylandAbstract::staticMetaObject>}, stringdata = 0x5637595f3600 <qt_meta_stringdata_KWin__ApplicationWayland>, data = 0x5637595f35c0 <qt_meta_data_KWin__ApplicationWayland>, static_metacall = 0x5637595ba910 <KWin::ApplicationWayland::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, m_startXWayland = true, m_applicationsToStart = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {d = 0x56375b0bd540}, d = 0x56375b0bd540}}, <No data fields>}, m_inputMethodServerToStart = {d = 0x7fb56c9c4aa0 <QArrayData::shared_null>}, m_environment = {d = {d = 0x56375b0bd0c0}}, m_sessionArgument = {d = 0x7fb56c9c4aa0 <QArrayData::shared_null>}, m_xwayland = 0x56375b0634b0, m_settingsWatcher = {value = 0x56375a521ed0, d = 0x56375a521a70}}
        availablePlugins = {d = 0x56375a4da320}
        hasPlugin = {__availablePlugins = @0x7ffe344682d0}
        hasSizeOption = <optimized out>
        hasOutputCountOption = <optimized out>
        hasX11Option = <optimized out>
        hasVirtualOption = <optimized out>
        hasWaylandOption = <optimized out>
        hasFramebufferOption = <optimized out>
        hasDrmOption = 152
        xwaylandOption = {d = {d = 0x56375a4ff240}}
        waylandSocketOption = {d = {d = 0x56375a4ef130}}
        framebufferOption = {d = {d = 0x56375a4ff2f0}}
        framebufferDeviceOption = {d = {d = 0x56375a4fefe0}}
        x11DisplayOption = {d = {d = 0x56375a4fe410}}
        waylandDisplayOption = {d = {d = 0x56375a4ef8e0}}
        virtualFbOption = {d = {d = 0x56375a50e500}}
        widthOption = {d = {d = 0x56375a4c3650}}
        heightOption = {d = {d = 0x56375a4d32d0}}
        scaleOption = {d = {d = 0x56375a4ef070}}
        outputCountOption = {d = {d = 0x56375a510cc0}}
        waylandSocketFdOption = {d = {d = 0x56375a513df0}}
        replaceOption = {d = {d = 0x56375a4fd6c0}}
        parser = {d = 0x56375a4fef30}
        libinputOption = {d = {d = 0x56375a515ca0}}
        drmOption = {d = {d = 0x56375a515ce0}}
        inputMethodOption = {d = {d = 0x56375a506060}}
        listBackendsOption = {d = {d = 0x56375a5060a0}}
        screenLockerOption = {d = {d = 0x56375a506300}}
        noScreenLockerOption = {d = {d = 0x56375a5064e0}}
        noGlobalShortcutsOption = {d = {d = 0x56375a506750}}
        noActivitiesOption = {d = {d = 0x56375a5145a0}}
        exitWithSessionOption = {d = {d = 0x56375a5146b0}}
        pluginName = {d = 0x5637595f49e0 <KWin::s_drmPlugin::{lambda()#1}::operator()() const::qstring_literal>}
        initialWindowSize = {wd = 1024, ht = 768}
        deviceIdentifier = {d = 0x7fb56c9c4aa0 <QArrayData::shared_null>}
        outputCount = 1
        outputScale = 1
        pluginIt = <optimized out>
        server = 0x56375a518d30
        flags = {i = 0}
Comment 1 David Edmundson 2021-06-27 22:27:09 UTC

*** This bug has been marked as a duplicate of bug 438789 ***
Comment 2 Zamundaaa 2021-06-28 20:13:53 UTC
Git commit 2ecce63d93686df4be8b41cf58e66b4659220fa6 by Xaver Hugl.
Committed on 28/06/2021 at 20:13.
Pushed by zamundaaa into branch 'master'.

platforms/drm: don't crash if drmModeGetConnector fails

I don't think this is the cause of 439208, where it's likely only a
side effect of some other issue; should be guarded against anyways.

M  +9    -2    src/plugins/platforms/drm/drm_object_connector.cpp

https://invent.kde.org/plasma/kwin/commit/2ecce63d93686df4be8b41cf58e66b4659220fa6
Comment 3 Zamundaaa 2021-06-28 20:14:24 UTC
Git commit 03dc0681defa3f2f28187c39f1adf935251cd8fe by Xaver Hugl.
Committed on 28/06/2021 at 20:14.
Pushed by zamundaaa into branch 'Plasma/5.22'.

platforms/drm: don't crash if drmModeGetConnector fails

I don't think this is the cause of 439208, where it's likely only a
side effect of some other issue; should be guarded against anyways.


(cherry picked from commit 2ecce63d93686df4be8b41cf58e66b4659220fa6)

M  +9    -2    src/plugins/platforms/drm/drm_object_connector.cpp

https://invent.kde.org/plasma/kwin/commit/03dc0681defa3f2f28187c39f1adf935251cd8fe