Bug 490356

Summary: PowerDevil crash in Core::onResumingFromIdle()
Product: [Plasma] Powerdevil Reporter: antxzq
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: gufideg, jpetso, kde115599, kevin.legouguec, me, naohoshino, natalie_clarius, nate, stakanov.s
Priority: NOR Keywords: drkonqi
Version: 6.1.2   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=490421
Latest Commit: Version Fixed In: 6.1.4
Sentry Crash Report: https://crash-reports.kde.org/organizations/kde/issues/45975/events/306d328ccd7b474798db7503c975865d/

Description antxzq 2024-07-16 12:41:10 UTC
Application: org_kde_powerdevil (6.1.2)

Qt Version: 6.7.2
Frameworks Version: 6.3.0
Operating System: Linux 6.9.8-200.fc40.x86_64 x86_64
Windowing System: Wayland
Distribution: "Fedora Linux 40.20240715.0 (Kinoite)"
DrKonqi: 6.1.2 [CoredumpBackend]

-- Information about the crash:
Power Manager crashed and reset monitor (DisplayPort) backlight to 0 (dpms)

The reporter is unsure if this crash is reproducible.

-- Backtrace:
Application: KDE Power Management System (org_kde_powerdevil), signal: Segmentation fault


This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) [answered N; input not from terminal]
Debuginfod has been disabled.
To make this setting permanent, add 'set debuginfod enabled off' to .gdbinit.
[New LWP 2093]
[New LWP 2153]
[New LWP 2441]
[New LWP 2168]
[New LWP 2182]
[New LWP 2167]
[New LWP 2184]
[New LWP 2154]
[New LWP 2152]
[New LWP 2183]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/usr/libexec/org_kde_powerdevil'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f66b72a84a4 in __pthread_kill_implementation () from /lib64/libc.so.6
[Current thread is 1 (Thread 0x7f66afccc400 (LWP 2093))]
Cannot QML trace cores :(
[Current thread is 1 (Thread 0x7f66afccc400 (LWP 2093))]

Thread 10 (Thread 0x7f6683e006c0 (LWP 2183)):
#0  0x00007f66b731c67d in poll () from /lib64/libc.so.6
#1  0x00007f66b60bbc34 in g_main_context_iterate_unlocked.isra () from /lib64/libglib-2.0.so.0
#2  0x00007f66b605b383 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#3  0x00007f66b605b3e1 in glib_worker_main () from /lib64/libglib-2.0.so.0
#4  0x00007f66b608a813 in g_thread_proxy () from /lib64/libglib-2.0.so.0
#5  0x00007f66b72a6507 in start_thread () from /lib64/libc.so.6
#6  0x00007f66b732a40c in clone3 () from /lib64/libc.so.6

Thread 9 (Thread 0x7f66a1e006c0 (LWP 2152)):
#0  0x00007f66b731c67d in poll () from /lib64/libc.so.6
#1  0x00007f66b60bbc34 in g_main_context_iterate_unlocked.isra () from /lib64/libglib-2.0.so.0
#2  0x00007f66b605b383 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#3  0x00007f66b7c850a3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#4  0x00007f66b79a3b03 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#5  0x00007f66b7ab7e4f in QThread::exec() () from /lib64/libQt6Core.so.6
#6  0x00007f66b8b6ae41 in QDBusConnectionManager::run() () from /lib64/libQt6DBus.so.6
#7  0x00007f66b7b5463c in QThreadPrivate::start(void*) () from /lib64/libQt6Core.so.6
#8  0x00007f66b72a6507 in start_thread () from /lib64/libc.so.6
#9  0x00007f66b732a40c in clone3 () from /lib64/libc.so.6

Thread 8 (Thread 0x7f66a0a006c0 (LWP 2154)):
#0  0x00007f66b731c67d in poll () from /lib64/libc.so.6
#1  0x00007f66b4eeedf5 in QtWaylandClient::EventThread::run() () from /lib64/libQt6WaylandClient.so.6
#2  0x00007f66b7b5463c in QThreadPrivate::start(void*) () from /lib64/libQt6Core.so.6
#3  0x00007f66b72a6507 in start_thread () from /lib64/libc.so.6
#4  0x00007f66b732a40c in clone3 () from /lib64/libc.so.6

Thread 7 (Thread 0x7f66834006c0 (LWP 2184)):
#0  0x00007f66b731c67d in poll () from /lib64/libc.so.6
#1  0x00007f66b60bbc34 in g_main_context_iterate_unlocked.isra () from /lib64/libglib-2.0.so.0
#2  0x00007f66b605ff37 in g_main_loop_run () from /lib64/libglib-2.0.so.0
#3  0x00007f66b0030682 in gdbus_shared_thread_func.lto_priv () from /lib64/libgio-2.0.so.0
#4  0x00007f66b608a813 in g_thread_proxy () from /lib64/libglib-2.0.so.0
#5  0x00007f66b72a6507 in start_thread () from /lib64/libc.so.6
#6  0x00007f66b732a40c in clone3 () from /lib64/libc.so.6

Thread 6 (Thread 0x7f66996006c0 (LWP 2167)):
#0  0x00007f66b72a2be9 in __futex_abstimed_wait_common () from /lib64/libc.so.6
#1  0x00007f66b72a5639 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libc.so.6
#2  0x00007f66998a7cfd in cnd_wait () from /usr/lib64/dri/iris_dri.so
#3  0x00007f6699884acb in util_queue_thread_func () from /usr/lib64/dri/iris_dri.so
#4  0x00007f66998a7c2c in impl_thrd_routine () from /usr/lib64/dri/iris_dri.so
#5  0x00007f66b72a6507 in start_thread () from /lib64/libc.so.6
#6  0x00007f66b732a40c in clone3 () from /lib64/libc.so.6

Thread 5 (Thread 0x7f6688c006c0 (LWP 2182)):
#0  0x00007f66b73281dd in syscall () from /lib64/libc.so.6
#1  0x00007f66b60b8ccd in g_cond_wait () from /lib64/libglib-2.0.so.0
#2  0x00007f66b602461b in g_async_queue_pop_intern_unlocked () from /lib64/libglib-2.0.so.0
#3  0x00007f66b608ba03 in g_thread_pool_spawn_thread () from /lib64/libglib-2.0.so.0
#4  0x00007f66b608a813 in g_thread_proxy () from /lib64/libglib-2.0.so.0
#5  0x00007f66b72a6507 in start_thread () from /lib64/libc.so.6
#6  0x00007f66b732a40c in clone3 () from /lib64/libc.so.6

Thread 4 (Thread 0x7f6698c006c0 (LWP 2168)):
#0  0x00007f66b72a2be9 in __futex_abstimed_wait_common () from /lib64/libc.so.6
#1  0x00007f66b72a5639 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libc.so.6
#2  0x00007f66998a7cfd in cnd_wait () from /usr/lib64/dri/iris_dri.so
#3  0x00007f6699884acb in util_queue_thread_func () from /usr/lib64/dri/iris_dri.so
#4  0x00007f66998a7c2c in impl_thrd_routine () from /usr/lib64/dri/iris_dri.so
#5  0x00007f66b72a6507 in start_thread () from /lib64/libc.so.6
#6  0x00007f66b732a40c in clone3 () from /lib64/libc.so.6

Thread 3 (Thread 0x7f6682a006c0 (LWP 2441)):
#0  0x00007f66b72f2a53 in clock_nanosleep@GLIBC_2.2.5 () from /lib64/libc.so.6
#1  0x00007f66b72fea87 in nanosleep () from /lib64/libc.so.6
#2  0x00007f66b7329f1a in usleep () from /lib64/libc.so.6
#3  0x00007f66b717396e in ddc_watch_displays_using_udev () from /lib64/libddcutil.so.5
#4  0x00007f66b608a813 in g_thread_proxy () from /lib64/libglib-2.0.so.0
#5  0x00007f66b72a6507 in start_thread () from /lib64/libc.so.6
#6  0x00007f66b732a40c in clone3 () from /lib64/libc.so.6

Thread 2 (Thread 0x7f66a14006c0 (LWP 2153)):
#0  0x00007f66b72a2be9 in __futex_abstimed_wait_common () from /lib64/libc.so.6
#1  0x00007f66b72a5639 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libc.so.6
#2  0x00007f66b7b60efb in QWaitCondition::wait(QMutex*, QDeadlineTimer) () from /lib64/libQt6Core.so.6
#3  0x00007f66b4eeed8e in QtWaylandClient::EventThread::run() () from /lib64/libQt6WaylandClient.so.6
#4  0x00007f66b7b5463c in QThreadPrivate::start(void*) () from /lib64/libQt6Core.so.6
#5  0x00007f66b72a6507 in start_thread () from /lib64/libc.so.6
#6  0x00007f66b732a40c in clone3 () from /lib64/libc.so.6

Thread 1 (Thread 0x7f66afccc400 (LWP 2093)):
[KCrash Handler]
#4  0x0000000000000000 in ?? ()
#5  0x00007f66b8eb70fa in PowerDevil::Core::onResumingFromIdle() () from /lib64/libpowerdevilcore.so.2
#6  0x00007f66b79fc872 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt6Core.so.6
#7  0x00007f66b7ee6b54 in QtPrivate::QCallableObject<KIdleTime::KIdleTime()::{lambda()#1}, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) () from /lib64/libKF6IdleTime.so.6
#8  0x00007f66b79fc872 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt6Core.so.6
#9  0x00007f66b79fc872 in void doActivate<false>(QObject*, int, void**) () from /lib64/libQt6Core.so.6
#10 0x00007f66b276c056 in ffi_call_unix64 () from /lib64/libffi.so.8
#11 0x00007f66b27686a0 in ffi_call_int.lto_priv () from /lib64/libffi.so.8
#12 0x00007f66b276b4ee in ffi_call () from /lib64/libffi.so.8
#13 0x00007f66b54bdf2e in wl_closure_invoke.constprop () from /lib64/libwayland-client.so.0
#14 0x00007f66b54be7a3 in dispatch_event.isra () from /lib64/libwayland-client.so.0
#15 0x00007f66b54bea4c in wl_display_dispatch_queue_pending () from /lib64/libwayland-client.so.0
#16 0x00007f66b4eeec52 in QtWaylandClient::QWaylandDisplay::flushRequests() () from /lib64/libQt6WaylandClient.so.6
#17 0x00007f66b79edd4b in QObject::event(QEvent*) () from /lib64/libQt6Core.so.6
#18 0x00007f66b7996dc8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib64/libQt6Core.so.6
#19 0x00007f66b799ab91 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /lib64/libQt6Core.so.6
#20 0x00007f66b7c858ef in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /lib64/libQt6Core.so.6
#21 0x00007f66b6059e8c in g_main_context_dispatch_unlocked.lto_priv () from /lib64/libglib-2.0.so.0
#22 0x00007f66b60bbc98 in g_main_context_iterate_unlocked.isra () from /lib64/libglib-2.0.so.0
#23 0x00007f66b605b383 in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#24 0x00007f66b7c850a3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#25 0x00007f66b79a3b03 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib64/libQt6Core.so.6
#26 0x00007f66b799f9bc in QCoreApplication::exec() () from /lib64/libQt6Core.so.6
#27 0x0000555f2c24ee6c in main ()

Reported using DrKonqi
Comment 1 antxzq 2024-07-16 12:42:25 UTC
It happened after waking up display from sleep mode
Comment 2 Jakob Petsovits 2024-07-18 11:35:05 UTC
Likely also fixed by https://invent.kde.org/plasma/powerdevil/-/merge_requests/406, although the initial target of that fix was the backtrace of Bug 490421. Thanks for reporting!
Comment 3 Jakob Petsovits 2024-07-18 11:39:08 UTC
*** Bug 489923 has been marked as a duplicate of this bug. ***
Comment 4 Jakob Petsovits 2024-07-18 11:41:40 UTC
Renaming from the original title "Power Manager crashed and reset monitor (DisplayPort) backlight to 0 (dpms)".
Comment 5 Jakob Petsovits 2024-07-18 17:14:01 UTC
Git commit 7a929fa01ed036f60c5a15c72416b4e40eb03160 by Jakob Petsovits.
Committed on 18/07/2024 at 12:25.
Pushed by jpetso into branch 'master'.

daemon: Don't leave dangling Action pointers in idle-time containers

If we delete the Action but don't clean up related map/set elements,
the powerdevil daemon can crash e.g. in Core::onResumingFromIdle()
and Core::onKIdleTimeoutReached().

This has been an issue since commit 584cfdf0 (or d91bc62f on 6.1)
which made it possible for already-created actions to get deleted
again at a later time.
Related: bug 490421

M  +10   -4    daemon/powerdevilcore.cpp

https://invent.kde.org/plasma/powerdevil/-/commit/7a929fa01ed036f60c5a15c72416b4e40eb03160
Comment 6 Jakob Petsovits 2024-07-18 17:17:58 UTC
Git commit 8c1686c9e97edb9a06e06e2f41cfe5351cef7986 by Jakob Petsovits.
Committed on 18/07/2024 at 17:14.
Pushed by jpetso into branch 'Plasma/6.1'.

daemon: Don't leave dangling Action pointers in idle-time containers

If we delete the Action but don't clean up related map/set elements,
the powerdevil daemon can crash e.g. in Core::onResumingFromIdle()
and Core::onKIdleTimeoutReached().

This has been an issue since commit 584cfdf0 (or d91bc62f on 6.1)
which made it possible for already-created actions to get deleted
again at a later time.
Related: bug 490421


(cherry picked from commit 7a929fa01ed036f60c5a15c72416b4e40eb03160)

Co-authored-by: Jakob Petsovits <jpetso@petsovits.com>

M  +10   -4    daemon/powerdevilcore.cpp

https://invent.kde.org/plasma/powerdevil/-/commit/8c1686c9e97edb9a06e06e2f41cfe5351cef7986
Comment 7 Jakob Petsovits 2024-07-22 08:40:59 UTC
Sorry about the version tag, the fix didn't make it into Plasma 6.1.3 but instead will be in 6.1.4 initially.
Comment 8 Jakob Petsovits 2024-07-24 10:24:46 UTC
*** Bug 490508 has been marked as a duplicate of this bug. ***
Comment 9 Nicolas Fella 2024-07-26 11:26:46 UTC
*** Bug 490836 has been marked as a duplicate of this bug. ***
Comment 10 Nicolas Fella 2024-07-26 11:27:04 UTC
*** Bug 490841 has been marked as a duplicate of this bug. ***