Bug 442822

Summary: intermittent kded5 crash
Product: [Plasma] KScreen Reporter: Ryan Murray <rmurray>
Component: commonAssignee: Fabian Vogt <fabian>
Status: RESOLVED FIXED    
Severity: crash CC: catalin.m.andrei10, fabian, nate
Priority: NOR    
Version: 5.22.4   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 5.23.1

Description Ryan Murray 2021-09-23 04:07:55 UTC
SUMMARY
kded5 

STEPS TO REPRODUCE
1. KSCREEN_BACKEND=qscreen exported via .config/plasma-workspace/env/kscreen.sh
2. NVIDIA driver with 3 displays configured as: Option         "metamodes" "DP-0: nvidia-auto-select +2160+1240, DP-4: nvidia-auto-select +6000+1422 {AllowGSYNCCompatible=On}, DP-2: nvidia-auto-select +0+0 {rotation=left}"  DP-0 is 144hz, the other two are 60hz, one of which is rotated left.
3. have option "nvidiaXineramaInfoOrder" "DFP-1" in the X config

OBSERVED RESULT

I get intermittent groupings of this crash when DFP-1 is listed first in XineramaInfoOrder.  It goes away if set to DFP-5 (the non-rotated 60hz).  However, that config causes fullscreen games to want to render at 144hz to the 60hz display.

Application: kded5 (kded5), signal: Segmentation fault
Content of s_kcrashErrorMessage: [Current thread is 1 (LWP 30030)]
[KCrash Handler]
#6  QString::QString(QString const&) (other=Python Exception <class 'gdb.MemoryError'> Cannot access memory at address 0x10: 
#7  KScreen::Mode::id() const (this=this@entry=0x0) at ./src/mode.cpp:57
#8  0x00007f0c542e2597 in Generator::cloneScreens(QMap<int, QSharedPointer<KScreen::Output> >&) (this=this@entry=0x55cbc8022410, connectedOutputs=...) at ./kded/generator.cpp:323
#9  0x00007f0c542e3f4e in Generator::fallbackIfNeeded(QSharedPointer<KScreen::Config> const&) (this=0x55cbc8022410, config=...) at ./kded/generator.cpp:135
#10 0x00007f0c542d7e80 in Generator::idealConfig(QSharedPointer<KScreen::Config> const&) (currentConfig=<optimized out>, currentConfig=<optimized out>, this=<optimized out>) at ./kded/generator.cpp:115
#11 KScreenDaemon::applyIdealConfig() (this=<optimized out>) at ./kded/daemon.cpp:297
#12 0x00007f0c542dbe77 in KScreenDaemon::applyConfig() (this=<optimized out>) at ./kded/daemon.cpp:219
#13 0x00007f0c542dc160 in operator() (__closure=0x55cbc7bc8bf0) at ./kded/daemon.cpp:125
#14 QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, KScreenDaemon::init()::<lambda()> >::call (arg=<optimized out>, f=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:146
#15 QtPrivate::Functor<KScreenDaemon::init()::<lambda()>, 0>::call<QtPrivate::List<>, void> (arg=<optimized out>, f=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:256
#16 QtPrivate::QFunctorSlotObject<KScreenDaemon::init()::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=<optimized out>, this_=0x55cbc7bc8be0, r=<optimized out>, a=<optimized out>, ret=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:443
#17 0x00007f0c6398e5c7 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc7ee14b40, r=0x55cbc7ed6e20, this=0x55cbc7bc8be0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#18 doActivate<false>(QObject*, int, void**) (sender=0x55cbc8022410, signal_index=3, argv=0x7ffc7ee14b40) at kernel/qobject.cpp:3886
#19 0x00007f0c6398e5c7 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc7ee14c20, r=0x55cbc8022410, this=0x55cbc8143170) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#20 doActivate<false>(QObject*, int, void**) (sender=0x55cbc8107cd0, signal_index=3, argv=0x7ffc7ee14c20, argv@entry=0x0) at kernel/qobject.cpp:3886
#21 0x00007f0c63987728 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=sender@entry=0x55cbc8107cd0, m=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3946
#22 0x00007f0c542e5f91 in Device::ready() (this=0x55cbc8107cd0) at ./obj-x86_64-linux-gnu/kded/kscreen_autogen/EWIEGA46WW/moc_device.cpp:186
#23 Device::setReady() (this=0x55cbc8107cd0) at ./kded/device.cpp:97
#24 Device::isLaptopFetched(QDBusPendingCallWatcher*) (this=0x55cbc8107cd0, watcher=0x55cbc7f37bd0) at ./kded/device.cpp:139
#25 0x00007f0c6398e5c7 in QtPrivate::QSlotObjectBase::call(QObject*, void**) (a=0x7ffc7ee14e10, r=0x55cbc8107cd0, this=0x55cbc80d2b60) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#26 doActivate<false>(QObject*, int, void**) (sender=0x55cbc7f37bd0, signal_index=3, argv=argv@entry=0x7ffc7ee14e10) at kernel/qobject.cpp:3886
#27 0x00007f0c63987728 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (sender=<optimized out>, m=m@entry=0x7f0c63d2f5e0 <QDBusPendingCallWatcher::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffc7ee14e10) at kernel/qobject.cpp:3946
#28 0x00007f0c63d0ff73 in QDBusPendingCallWatcher::finished(QDBusPendingCallWatcher*) (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qdbuspendingcall.cpp:158
#29 0x00007f0c6398410c in QObject::event(QEvent*) (this=0x55cbc7f37bd0, e=0x55cbc80d54d0) at kernel/qobject.cpp:1314
#30 0x00007f0c64696783 in QApplicationPrivate::notify_helper(QObject*, QEvent*) (this=<optimized out>, receiver=0x55cbc7f37bd0, e=0x55cbc80d54d0) at kernel/qapplication.cpp:3632
#31 0x00007f0c639567ba in QCoreApplication::notifyInternal2(QObject*, QEvent*) (receiver=0x55cbc7f37bd0, event=0x55cbc80d54d0) at kernel/qcoreapplication.cpp:1063
#32 0x00007f0c639597e1 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (receiver=0x0, event_type=0, data=0x55cbc7a3e6f0) at kernel/qcoreapplication.cpp:1817
#33 0x00007f0c639b0ba7 in postEventSourceDispatch(GSource*, GSourceFunc, gpointer) (s=0x55cbc7bf67a0) at kernel/qeventdispatcher_glib.cpp:277
#34 0x00007f0c6255e8eb in g_main_dispatch (context=0x7f0c58005000) at ../../../glib/gmain.c:3337
#35 g_main_context_dispatch (context=0x7f0c58005000) at ../../../glib/gmain.c:4055
#36 0x00007f0c625b1d28 in g_main_context_iterate.constprop.0 (context=context@entry=0x7f0c58005000, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4131
#37 0x00007f0c6255c023 in g_main_context_iteration (context=0x7f0c58005000, may_block=may_block@entry=1) at ../../../glib/gmain.c:4196
#38 0x00007f0c639b0204 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x55cbc7c0c430, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#39 0x00007f0c6395511b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7ffc7ee151e0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#40 0x00007f0c6395d604 in QCoreApplication::exec() () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#41 0x00007f0c63ed4520 in QGuiApplication::exec() () at kernel/qguiapplication.cpp:1867
#42 0x00007f0c646966f9 in QApplication::exec() () at kernel/qapplication.cpp:2824
#43 0x000055cbc5ab1ede in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at ./src/kded.cpp:782
[Inferior 1 (process 30030) detached]


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 21.04, w/ kubuntu-ppa backports
(available in About System)
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
I switched to the qscreen backend years ago when I was using the nvidia driver to scale on 2 4x3 monitors to line up with a 4k display.  Otherwise, the rw nature of the default backend would cause any unsupported features from the X config (like scaling at the time, and rotation until the recent changes) to be lost on the first write.
Comment 1 Ryan Murray 2021-09-23 04:13:55 UTC
All three displays that are set as nvidia-auto-select select 3840x2160
Comment 2 Bug Janitor Service 2021-10-11 20:59:12 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kscreen/-/merge_requests/46
Comment 3 Fabian Vogt 2021-10-12 08:52:37 UTC
Git commit 4a5a806120dbf4ccac41e9dccf214acb898dff34 by Fabian Vogt.
Committed on 11/10/2021 at 20:58.
Pushed by fvogt into branch 'master'.

Fix algorithm for common sizes in Generator::cloneScreens

The algorithm iterates all outputs and collects the intersection of all
supported sizes. To fill the set initially, it assigns the current sizes if
the preliminary result is empty, but this condition can also be true if the
previous intersection resulted in an empty set. This is the case for instance
when using 3 monitors, of which the second one doesn't have any modes in common
with the first (e.g. rotation) and without this fix, it would return all sizes
of the third monitor instead of an empty set.

Avoid this by giving up early when there's no intersection left.

M  +6    -2    kded/generator.cpp

https://invent.kde.org/plasma/kscreen/commit/4a5a806120dbf4ccac41e9dccf214acb898dff34
Comment 4 Fabian Vogt 2021-10-12 08:53:03 UTC
Git commit eac5fe142efa67e1ba3d491ffa7a735135c1abc3 by Fabian Vogt.
Committed on 12/10/2021 at 08:53.
Pushed by fvogt into branch 'Plasma/5.23'.

Fix algorithm for common sizes in Generator::cloneScreens

The algorithm iterates all outputs and collects the intersection of all
supported sizes. To fill the set initially, it assigns the current sizes if
the preliminary result is empty, but this condition can also be true if the
previous intersection resulted in an empty set. This is the case for instance
when using 3 monitors, of which the second one doesn't have any modes in common
with the first (e.g. rotation) and without this fix, it would return all sizes
of the third monitor instead of an empty set.

Avoid this by giving up early when there's no intersection left.


(cherry picked from commit 4a5a806120dbf4ccac41e9dccf214acb898dff34)

M  +6    -2    kded/generator.cpp

https://invent.kde.org/plasma/kscreen/commit/eac5fe142efa67e1ba3d491ffa7a735135c1abc3
Comment 5 Nicolas Fella 2022-10-17 16:17:41 UTC
*** Bug 460605 has been marked as a duplicate of this bug. ***