winft / disman

Qt/C++ display management library
GNU Lesser General Public License v2.1
3 stars 1 forks source link

Disman stops working out-of-the-box on X11 after a Plasma Wayland session #31

Closed romangg closed 8 months ago

romangg commented 4 years ago

In GitLab by @magiblot on Oct 6, 2020, 23:19

Hi there,

I am experiencing the following situations:

When Disman is not working on X11, I see the following messages:

I am using Disman at commit bcc6dbcf10d250d17a6c901c44cf790088925656 and mainline Kwin 5.19.5.

Thanks!

romangg commented 4 years ago

In GitLab by @magiblot on Oct 6, 2020, 23:26

From a Plasma Wayland session with Disman working out-of-the-box:

romangg commented 4 years ago

In GitLab by @magiblot on Oct 6, 2020, 23:51

Ah, here it is. For some reason, Disman tries to create a Wayland connection even though this is a X11 session. Then it crashes:

GDB Stacktrace: ``` Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007fdfeb54438a in QDebug::putString(QChar const*, unsigned long) () from /usr/lib/libQt5Core.so.5 #1 0x00007fdfe7d3be68 in QDebug::operator<< (t=..., t=..., this=0x7fff60c7ce20) at /usr/include/qt/QtCore/qarraydata.h:61 #2 operator() (__closure=0x563b9892bb00) at /usr/src/debug/disman/backends/wayland/waylandbackend.cpp:204 #3 QtPrivate::FunctorCall, QtPrivate::List<>, void, Disman::WaylandBackend::queryInterface(KPluginMetaData*):: >::call (arg=, f=...) at /usr/include/qt/QtCore/qobjectdefs_impl.h:146 #4 QtPrivate::Functor, 0>::call, void> (arg=, f=...) at /usr/include/qt/QtCore/qobjectdefs_impl.h:256 #5 QtPrivate::QFunctorSlotObject, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=, this_=0x563b9892baf0, r=, a=, ret=) at /usr/include/qt/QtCore/qobjectdefs_impl.h:443 #6 0x00007fdfeb668036 in ?? () from /usr/lib/libQt5Core.so.5 #7 0x00007fdfe6925436 in Disman::WaylandInterface::connectionFailed (this=, _t1=...) at backends/wayland/DismanWayland_autogen/EWIEGA46WW/moc_wayland_interface.cpp:179 #8 0x00007fdfe6a4160d in operator() (__closure=) at /usr/src/debug/disman/backends/wayland/plugins/kwinft/kwinft_interface.cpp:66 #9 QtPrivate::FunctorCall, QtPrivate::List<>, void, Disman::KwinftInterface::initConnection(QThread*):: >::call (arg=, f=...) at /usr/include/qt/QtCore/qobjectdefs_impl.h:146 #10 QtPrivate::Functor, 0>::call, void> (arg=, f=...) at /usr/include/qt/QtCore/qobjectdefs_impl.h:256 #11 QtPrivate::QFunctorSlotObject, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=, this_=, r=, a=, ret=) at /usr/include/qt/QtCore/qobjectdefs_impl.h:443 #12 0x00007fdfeb65d7e2 in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5 #13 0x00007fdfeb630cda in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 #14 0x00007fdfeb6337d3 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQt5Core.so.5 #15 0x00007fdfeb68a304 in ?? () from /usr/lib/libQt5Core.so.5 #16 0x00007fdfea449924 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #17 0x00007fdfea49d621 in ?? () from /usr/lib/libglib-2.0.so.0 #18 0x00007fdfea448131 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 #19 0x00007fdfeb689941 in QEventDispatcherGlib::processEvents(QFlags) () from /usr/lib/libQt5Core.so.5 #20 0x00007fdfeb62f65c in QEventLoop::exec(QFlags) () from /usr/lib/libQt5Core.so.5 #21 0x00007fdfe7d3cd2e in Disman::WaylandBackend::queryInterfaces (this=0x563b987f4940) at /usr/include/qt/QtCore/qflags.h:121 #22 0x00007fdfe7d3a6d7 in qt_plugin_instance () at backends/wayland/wayland_autogen/EWIEGA46WW/moc_waylandbackend.cpp:114 #23 0x00007fdfeb626c00 in ?? () from /usr/lib/libQt5Core.so.5 #24 0x00007fdfec037730 in Disman::BackendManager::load_backend_plugin (loader=0x563b9891a010, name=..., arguments=...) at /usr/src/debug/disman/lib/backendmanager.cpp:198 #25 0x0000563b97c90105 in BackendLoader::loadBackend (arguments=..., name=..., this=0x7fdfd8014550) at /usr/src/debug/disman/service/backendloader.cpp:121 #26 BackendLoader::requestBackend (this=0x7fdfd8014550, backendName=..., arguments=...) at /usr/src/debug/disman/service/backendloader.cpp:98 #27 0x0000563b97c91ac6 in BackendLoaderAdaptor::requestBackend (in1=..., in0=..., this=) at /usr/include/qt/QtCore/qscopedpointer.h:116 #28 BackendLoaderAdaptor::qt_static_metacall (_o=, _id=, _a=0x7fff60c7d750, _c=) at service/backendloaderadaptor.moc:100 #29 0x0000563b97c91c61 in BackendLoaderAdaptor::qt_static_metacall (_a=0x7fff60c7d750, _id=2, _c=QMetaObject::InvokeMetaMethod, _o=0x563b98918a10) at service/backendloaderadaptor.moc:137 #30 BackendLoaderAdaptor::qt_metacall (this=0x563b98918a10, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0x7fff60c7d750) at service/backendloaderadaptor.moc:137 #31 0x00007fdfeb8f0066 in ?? () from /usr/lib/libQt5DBus.so.5 #32 0x00007fdfeb8f365b in ?? () from /usr/lib/libQt5DBus.so.5 #33 0x00007fdfeb8f3f4a in ?? () from /usr/lib/libQt5DBus.so.5 #34 0x00007fdfeb8f6478 in ?? () from /usr/lib/libQt5DBus.so.5 #35 0x00007fdfeb65d7e2 in QObject::event(QEvent*) () from /usr/lib/libQt5Core.so.5 #36 0x00007fdfeb630cda in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib/libQt5Core.so.5 #37 0x00007fdfeb6337d3 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQt5Core.so.5 #38 0x00007fdfeb68a304 in ?? () from /usr/lib/libQt5Core.so.5 #39 0x00007fdfea449924 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #40 0x00007fdfea49d621 in ?? () from /usr/lib/libglib-2.0.so.0 #41 0x00007fdfea448131 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 #42 0x00007fdfeb689941 in QEventDispatcherGlib::processEvents(QFlags) () from /usr/lib/libQt5Core.so.5 #43 0x00007fdfeb62f65c in QEventLoop::exec(QFlags) () from /usr/lib/libQt5Core.so.5 #44 0x00007fdfeb637af4 in QCoreApplication::exec() () from /usr/lib/libQt5Core.so.5 #45 0x0000563b97c8f295 in main (argc=, argv=0x7fff60c7ddd0) at /usr/src/debug/disman/service/main.cpp:49 ```
romangg commented 4 years ago

In GitLab by @magiblot on Oct 7, 2020, 24:01

Valgrind shows the program crashes after a beyond-bounds access.

Valgrind log: ``` ==2219== Memcheck, a memory error detector ==2219== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al. ==2219== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info ==2219== Command: /usr/lib/disman_backend_launcher.bak ==2219== ==2219== Invalid read of size 8 ==2219== at 0x8FCBE46: data (qarraydata.h:59) ==2219== by 0x8FCBE46: data (qarraydata.h:208) ==2219== by 0x8FCBE46: constData (qstring.h:1081) ==2219== by 0x8FCBE46: operator<< (qdebug.h:161) ==2219== by 0x8FCBE46: operator() (waylandbackend.cpp:204) ==2219== by 0x8FCBE46: call (qobjectdefs_impl.h:146) ==2219== by 0x8FCBE46: call, void> (qobjectdefs_impl.h:256) ==2219== by 0x8FCBE46: QtPrivate::QFunctorSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobjectdefs_impl.h:443) ==2219== by 0x5311035: ??? (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0xB7DF435: Disman::WaylandInterface::connectionFailed(QString const&) (moc_wayland_interface.cpp:179) ==2219== by 0xB78487C: operator() (wlroots_interface.cpp:66) ==2219== by 0xB78487C: call (qobjectdefs_impl.h:146) ==2219== by 0xB78487C: call, void> (qobjectdefs_impl.h:256) ==2219== by 0xB78487C: QtPrivate::QFunctorSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobjectdefs_impl.h:443) ==2219== by 0x53067E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52D9CD9: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52DC7D2: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x5333303: ??? (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x641D923: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x6471620: ??? (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x641C130: g_main_context_iteration (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x5332940: QEventDispatcherGlib::processEvents(QFlags) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52D865B: QEventLoop::exec(QFlags) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x8FCCD2D: Disman::WaylandBackend::queryInterfaces() (waylandbackend.cpp:178) ==2219== by 0x8FCA6D6: qt_plugin_instance (moc_waylandbackend.cpp:114) ==2219== by 0x52CFBFF: ??? (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x489E72F: Disman::BackendManager::load_backend_plugin(QPluginLoader*, QString const&, QMap const&) (backendmanager.cpp:198) ==2219== by 0x10C104: loadBackend (backendloader.cpp:121) ==2219== by 0x10C104: BackendLoader::requestBackend(QString const&, QMap const&) (backendloader.cpp:98) ==2219== by 0x10DAC5: requestBackend (backendloaderadaptor.cpp:51) ==2219== by 0x10DAC5: BackendLoaderAdaptor::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) [clone .part.0] (backendloaderadaptor.moc:100) ==2219== by 0x10DC60: qt_static_metacall (backendloaderadaptor.moc:93) ==2219== by 0x10DC60: BackendLoaderAdaptor::qt_metacall(QMetaObject::Call, int, void**) (backendloaderadaptor.moc:137) ==2219== by 0x4FC1065: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x4FC465A: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x4FC4F49: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x4FC7477: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x53067E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52D9CD9: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52DC7D2: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x5333303: ??? (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x641D923: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x6471620: ??? (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x641C130: g_main_context_iteration (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x5332940: QEventDispatcherGlib::processEvents(QFlags) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52D865B: QEventLoop::exec(QFlags) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52E0AF3: QCoreApplication::exec() (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x10B294: main (main.cpp:49) ==2219== Address 0xa02e0cc is 4 bytes after a block of size 104 alloc'd ==2219== at 0x483ADEF: operator new(unsigned long) (vg_replace_malloc.c:342) ==2219== by 0x52D8159: QEventLoop::QEventLoop(QObject*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x8FCCE0A: Disman::WaylandBackend::WaylandBackend() (waylandbackend.cpp:43) ==2219== by 0x8FCA6D6: qt_plugin_instance (moc_waylandbackend.cpp:114) ==2219== by 0x52CFBFF: ??? (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x489E72F: Disman::BackendManager::load_backend_plugin(QPluginLoader*, QString const&, QMap const&) (backendmanager.cpp:198) ==2219== by 0x10C104: loadBackend (backendloader.cpp:121) ==2219== by 0x10C104: BackendLoader::requestBackend(QString const&, QMap const&) (backendloader.cpp:98) ==2219== by 0x10DAC5: requestBackend (backendloaderadaptor.cpp:51) ==2219== by 0x10DAC5: BackendLoaderAdaptor::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) [clone .part.0] (backendloaderadaptor.moc:100) ==2219== by 0x10DC60: qt_static_metacall (backendloaderadaptor.moc:93) ==2219== by 0x10DC60: BackendLoaderAdaptor::qt_metacall(QMetaObject::Call, int, void**) (backendloaderadaptor.moc:137) ==2219== by 0x4FC1065: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x4FC465A: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x4FC4F49: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x4FC7477: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x53067E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52D9CD9: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52DC7D2: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x5333303: ??? (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x641D923: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x6471620: ??? (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x641C130: g_main_context_iteration (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x5332940: QEventDispatcherGlib::processEvents(QFlags) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52D865B: QEventLoop::exec(QFlags) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52E0AF3: QCoreApplication::exec() (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x10B294: main (main.cpp:49) ==2219== ==2219== ==2219== Process terminating with default action of signal 6 (SIGABRT): dumping core ==2219== at 0x5794615: raise (in /usr/lib/libc-2.32.so) ==2219== by 0x577D861: abort (in /usr/lib/libc-2.32.so) ==2219== by 0x50B69AB: QMessageLogger::fatal(char const*, ...) const (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x50B5D58: qt_assert(char const*, char const*, int) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x8FB3211: QArrayData::data() [clone .part.0] (qarraydata.h:59) ==2219== by 0x8FB3288: data (qobjectdefs_impl.h:449) ==2219== by 0x8FB3288: data (qarraydata.h:208) ==2219== by 0x8FB3288: constData (qstring.h:1081) ==2219== by 0x8FB3288: operator<< (qdebug.h:161) ==2219== by 0x8FB3288: operator() (waylandbackend.cpp:204) ==2219== by 0x8FB3288: call (qobjectdefs_impl.h:146) ==2219== by 0x8FB3288: call, void> (qobjectdefs_impl.h:256) ==2219== by 0x8FB3288: QtPrivate::QFunctorSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) [clone .cold] (qobjectdefs_impl.h:443) ==2219== by 0x5311035: ??? (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0xB7DF435: Disman::WaylandInterface::connectionFailed(QString const&) (moc_wayland_interface.cpp:179) ==2219== by 0xB78487C: operator() (wlroots_interface.cpp:66) ==2219== by 0xB78487C: call (qobjectdefs_impl.h:146) ==2219== by 0xB78487C: call, void> (qobjectdefs_impl.h:256) ==2219== by 0xB78487C: QtPrivate::QFunctorSlotObject, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (qobjectdefs_impl.h:443) ==2219== by 0x53067E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52D9CD9: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52DC7D2: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x5333303: ??? (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x641D923: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x6471620: ??? (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x641C130: g_main_context_iteration (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x5332940: QEventDispatcherGlib::processEvents(QFlags) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52D865B: QEventLoop::exec(QFlags) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x8FCCD2D: Disman::WaylandBackend::queryInterfaces() (waylandbackend.cpp:178) ==2219== by 0x8FCA6D6: qt_plugin_instance (moc_waylandbackend.cpp:114) ==2219== by 0x52CFBFF: ??? (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x489E72F: Disman::BackendManager::load_backend_plugin(QPluginLoader*, QString const&, QMap const&) (backendmanager.cpp:198) ==2219== by 0x10C104: loadBackend (backendloader.cpp:121) ==2219== by 0x10C104: BackendLoader::requestBackend(QString const&, QMap const&) (backendloader.cpp:98) ==2219== by 0x10DAC5: requestBackend (backendloaderadaptor.cpp:51) ==2219== by 0x10DAC5: BackendLoaderAdaptor::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) [clone .part.0] (backendloaderadaptor.moc:100) ==2219== by 0x10DC60: qt_static_metacall (backendloaderadaptor.moc:93) ==2219== by 0x10DC60: BackendLoaderAdaptor::qt_metacall(QMetaObject::Call, int, void**) (backendloaderadaptor.moc:137) ==2219== by 0x4FC1065: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x4FC465A: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x4FC4F49: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x4FC7477: ??? (in /usr/lib/libQt5DBus.so.5.15.1) ==2219== by 0x53067E1: QObject::event(QEvent*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52D9CD9: QCoreApplication::notifyInternal2(QObject*, QEvent*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52DC7D2: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x5333303: ??? (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x641D923: g_main_context_dispatch (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x6471620: ??? (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x641C130: g_main_context_iteration (in /usr/lib/libglib-2.0.so.0.6600.1) ==2219== by 0x5332940: QEventDispatcherGlib::processEvents(QFlags) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52D865B: QEventLoop::exec(QFlags) (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x52E0AF3: QCoreApplication::exec() (in /usr/lib/libQt5Core.so.5.15.1) ==2219== by 0x10B294: main (main.cpp:49) ==2219== ==2219== HEAP SUMMARY: ==2219== in use at exit: 1,157,656 bytes in 18,414 blocks ==2219== total heap usage: 56,950 allocs, 38,536 frees, 150,837,402 bytes allocated ==2219== ==2219== LEAK SUMMARY: ==2219== definitely lost: 512 bytes in 1 blocks ==2219== indirectly lost: 0 bytes in 0 blocks ==2219== possibly lost: 2,400 bytes in 10 blocks ==2219== still reachable: 1,154,744 bytes in 18,403 blocks ==2219== of which reachable via heuristic: ==2219== newarray : 24 bytes in 1 blocks ==2219== suppressed: 0 bytes in 0 blocks ==2219== Rerun with --leak-check=full to see details of leaked memory ==2219== ==2219== For lists of detected and suppressed errors, rerun with: -s ==2219== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0) ```
romangg commented 4 years ago

In GitLab by @magiblot on Oct 7, 2020, 01:20

With the fix in !19 applied, Disman does no longer crash. However, since it seems to fail at creating a Wayland connection, it stays resident without providing any functionality (note the missing /backend entry):

[magiblot@ArchLinux ~]$ qdbus org.kwinft.disman
/

So, even though disman_backend_launcher is running, System Settings still complains about not finding a Disman backend.

romangg commented 4 years ago

In GitLab by @magiblot on Oct 7, 2020, 18:02

Disman chooses the Wayland backend because the WAYLAND_DISPLAY variable is actually set:

DISMAN_BACKEND: (nil)
WAYLAND_DISPLAY: 0x7ffeab11bba0 ("wayland-0")
DISPLAY: 0x7ffeab11bccd (":0")
select: wayland

Which makes no sense at a first glance. Both WAYLAND_DISPLAY and DISPLAY variables are unset when checking from the console (after exiting Plasma Wayland).

romangg commented 4 years ago

But when you logout from the Wayland session the disman_backend_process was actually killed right? It's weird indeed that the env variable is still present for the D-Bus service.

romangg commented 4 years ago

In GitLab by @magiblot on Oct 7, 2020, 18:50

From what I can see, the disman_backend_launcher process does not outlive the Plasma session.

romangg commented 4 years ago

In GitLab by @magiblot on Oct 7, 2020, 23:30

I can confirm that the WAYLAND_DISPLAY environment variable is already set by the time disman_backend_launcher is launched (i.e. its not set by mistake from within Disman). I don't think I can determine the cause of this.

A good workaround is to export DISMAN_BACKEND=randr in .xinitrc.

romangg commented 4 years ago

In GitLab by @magiblot on Oct 7, 2020, 23:34

On the other hand, adding unset WAYLAND_DISPLAY in .xinitrc before startplasma-x11 does not change the result.

romangg commented 4 years ago

In GitLab by @magiblot on Oct 8, 2020, 24:23

I realized that after adding export DISMAN_BACKEND=randr in .xinitrc, Disman still sees DISMAN_BACKEND=randr on Wayland. So what's happening here is that someone is backing up environment variables and then applying them on Disman. This is indeed very unexpected and strange.

Another example:

  1. Run DISMAN_BACKEND=wayland startplasma-wayland and exit Plasma.
  2. Make sure that the DISMAN_BACKEND variable is not set in the environment or in .xinitrc. Also make sure that .xinitrc invokes startplasma-x11.
  3. Run startx.
  4. Result: Disman still observes DISMAN_BACKEND=wayland.
romangg commented 4 years ago

In GitLab by @magiblot on Oct 8, 2020, 13:45

From what I can gather, systemd and dbus services require environment variables to be explicitly imported, since the process starting these services does not inherit the same environment than the process that requests the service to be started.

Assuming that dbus-update-activation-environment is involved in the process of setting Disman up, here's what can be found in its manpage:

LIMITATIONS

dbus-daemon does not provide a way to unset environment variables after they have been set (although systemd does), so dbus-update-activation-environment does not offer this either.

So there's not much that Disman can do about this. Falling back to X11 if wayland fails might work in the situation described in this issue, but it definitely wouldn't work if both a Wayland and an X11 session were running in parallel (not necessarily Plasma).

Is making DISMAN_IN_PROCESS the default a good idea?

romangg commented 4 years ago

In GitLab by @magiblot on Oct 8, 2020, 14:02

Setting DISMAN_IN_PROCESS=1 in my environment solves the issue. So if you agree with it, my suggested fix is to make this the default.

romangg commented 4 years ago

In GitLab by @magiblot on Oct 8, 2020, 15:24

I can confirm that this issue is caused by not using dbus-run-session. In my case I start Plasma sessions directly from the shell, so this is easy to fix for me. But I don't know about people using display managers.

romangg commented 4 years ago

I think in the case of display managers it is very likely that a clean D-Bus session is always setup for when the manager starts a session.

I would consider a display manager broken which does not ensure this.

romangg commented 4 years ago

I wrote a comment to the GTK issue that you did link in Gitter. Thanks for the hint!

As explained there my personal opinion at the moment in regards to the WAYLAND_DISPLAY environment variable is that using this is the "least worst" option to find out what windowing system we should presume.

Since you could solve the issue with dbus-run-session (I would say the issue was that the prior D-Bus session was reused and that reused old enthronement variables), shall we close this issue?

romangg commented 4 years ago

In GitLab by @magiblot on Oct 8, 2020, 17:42

Not yet, we should document this case somewhere so that users in the same situation can easily solve it.

romangg commented 4 years ago

In GitLab by @magiblot on Oct 8, 2020, 17:53

Well, yes, the issue can be closed, but not the merge request.

romangg commented 4 years ago

Agree.

romangg commented 4 years ago

Reopening as it can not be assumed a new D-Bus session is started on every new graphical session.

See:

So we need to find a way to reload backend plugins in case the graphical session was closed but the D-Bus session lived on.

romangg commented 4 years ago

mentioned in commit 8ddc15af95103b46dac429988ad4ebe1a1c35a97