Bug 489222 - display brightness changing to 1 (on PC external monitors, not a notebook)
Summary: display brightness changing to 1 (on PC external monitors, not a notebook)
Status: RESOLVED DUPLICATE of bug 489169
Alias: None
Product: Powerdevil
Classification: Plasma
Component: general (show other bugs)
Version: 6.1.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-26 10:26 UTC by ezh
Modified: 2024-06-26 21:59 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
List of all entries of coredumpctl --reverse (191.36 KB, image/png)
2024-06-26 20:26 UTC, ezh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ezh 2024-06-26 10:26:05 UTC
Fedora 40 & KDE 6.1.0
AMD Ryzen 5800X, AMD RX 480,  2 x Dell U2415 monitors, brightness is set to level 45.
I went of the PC, come back in 20 minutes. 
Monitors are sleeping, PC itself is working - all OK. 
Moving the mouse I'm waking the monitors up.
Now I see that monitors are very dark, open the brightness menu and see level is set to 1. On both monitors...

It happens not every time, but already 3 times (not sure, but seems it happened on KDE 6.0.5 as well).
I have never experienced before in my 30+ years on PC, that software can change the brightness level of an external monitor (not integrated one).
Comment 1 ezh 2024-06-26 10:29:30 UTC
BTW Today I've got "KDE Power Manager Crashes". 3 or 4 icons, I have sent the logs.
Comment 2 Nate Graham 2024-06-26 16:35:13 UTC
powerdevil crashing is definitely related, if not the actual root cause.

Can you attach a symbolicated backtrace of the crash? See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports#Retrieving_a_backtrace_using_coredumpctl
Comment 3 Nate Graham 2024-06-26 16:35:56 UTC
A change in Plasma 6.1 is that software now *can* change the brightness of an external monitor, BTW. So that's related too.
Comment 4 ezh 2024-06-26 18:41:41 UTC
Is this format OK?

Core was generated by `/usr/libexec/org_kde_powerdevil'.
Program terminated with signal SIGABRT, Aborted.
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44            return INTERNAL_SYSCALL_ERROR_P (ret) ? INTERNAL_SYSCALL_ERRNO (ret) : 0;                                                                                                                                         
[Current thread is 1 (Thread 0x7f8a016006c0 (LWP 19176))]
(gdb) bt
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007f8a394ab1b3 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#2  0x00007f8a3945365e in __GI_raise (sig=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f8a3af8e6c5 in KCrash::defaultCrashHandler (sig=6) at /usr/src/debug/kf6-kcrash-6.3.0-1.fc40.x86_64/src/kcrash.cpp:597
#4  <signal handler called>
#5  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#6  0x00007f8a394ab1b3 in __pthread_kill_internal (threadid=<optimized out>, signo=6) at pthread_kill.c:78
#7  0x00007f8a3945365e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#8  0x00007f8a3943b902 in __GI_abort () at abort.c:79
#9  0x00007f8a3808210c in g_assertion_message (domain=domain@entry=0x7f8a381822eb "GLib", file=file@entry=0x7f8a38183229 "../glib/ghash.c", line=line@entry=493, 
    func=func@entry=0x7f8a38127200 <__func__.25.lto_priv.3> "g_hash_table_remove_node", message=message@entry=0x7f89c8002da0 "assertion failed: (hash_table->nnodes > 0)") at ../glib/gtestutils.c:3331
#10 0x00007f8a380ef397 in g_assertion_message_expr (domain=0x7f8a381822eb "GLib", file=0x7f8a38183229 "../glib/ghash.c", line=493, func=0x7f8a38127200 <__func__.25.lto_priv.3> "g_hash_table_remove_node", 
    expr=<optimized out>) at ../glib/gtestutils.c:3357
#11 0x00007f8a380a3d87 in g_hash_table_remove_node (hash_table=0x55991ca1c120, i=<optimized out>, notify=<optimized out>) at ../glib/ghash.c:493
#12 0x00007f8a380acae9 in g_hash_table_remove_internal (hash_table=0x55991ca1c120, key=0x7f89c8001900, notify=1) at ../glib/ghash.c:1717
#13 g_hash_table_remove (hash_table=0x55991ca1c120, key=key@entry=0x7f89c8001900) at ../glib/ghash.c:1745
#14 0x00007f8a3925593e in ddc_close_display (dh=0x7f89c8001900) at ddc/ddc_packet_io.c:373
#15 0x00007f8a39299445 in ddca_close_display (ddca_dh=0x7f89c8001900) at libmain/api_displays.c:606
#16 0x00007f8a3af50f07 in BrightnessWorker::ddcSetBrightness (this=0x55991cc6a1c0, value=<optimized out>, display=<optimized out>) at /usr/src/debug/powerdevil-6.1.0-1.fc40.x86_64/daemon/controllers/ddcutildisplay.cpp:159
#17 0x00007f8a39bebdeb in QObject::event (this=0x55991cc6a1c0, e=0x7f8a1c031780) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qobject.cpp:1452
#18 0x00007f8a39b95b18 in QCoreApplication::notifyInternal2 (receiver=0x55991cc6a1c0, event=0x7f8a1c031780) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1134
#19 0x00007f8a39b95d7d in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1575
#20 0x00007f8a39b998c1 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x55991cc6fc50) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1932
#21 0x00007f8a39b99b6d in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1789
#22 0x00007f8a39e7d39f in postEventSourceDispatch (s=0x7f89c8000f20) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:244
#23 0x00007f8a380bee8c in g_main_dispatch (context=0x7f89c8000c60) at ../glib/gmain.c:3344
#24 g_main_context_dispatch_unlocked (context=0x7f89c8000c60) at ../glib/gmain.c:4152
#25 0x00007f8a38120c98 in g_main_context_iterate_unlocked.isra.0 (context=context@entry=0x7f89c8000c60, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4217
#26 0x00007f8a380c0383 in g_main_context_iteration (context=0x7f89c8000c60, may_block=1) at ../glib/gmain.c:4282
#27 0x00007f8a39e7cb53 in QEventDispatcherGlib::processEvents (this=0x7f89c8000b70, flags=...) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:394
#28 0x00007f8a39ba2713 in QEventLoop::exec (this=this@entry=0x7f8a015ffa70, flags=..., flags@entry=...) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/global/qflags.h:34
#29 0x00007f8a39cb414f in QThread::exec (this=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/global/qflags.h:74
#30 0x00007f8a39d4fc5c in operator() (__closure=<optimized out>) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/thread/qthread_unix.cpp:326
#31 (anonymous namespace)::terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> > (t=...) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/thread/qthread_unix.cpp:262
#32 QThreadPrivate::start (arg=0x55991cc62420) at /usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/thread/qthread_unix.cpp:285
#33 0x00007f8a394a91b7 in start_thread (arg=<optimized out>) at pthread_create.c:447
#34 0x00007f8a3952b3cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
Comment 5 ezh 2024-06-26 18:43:20 UTC
I have total:
Wed 2024-06-26 13:27:12 EEST  19080 1000 1000 SIGABRT present      /usr/libexec/org_kde_powerdevil                                                                                 2.7M
Wed 2024-06-26 12:46:22 EEST  18508 1000 1000 SIGABRT present      /usr/libexec/org_kde_powerdevil                                                                                 2.7M
Wed 2024-06-26 12:41:18 EEST  17971 1000 1000 SIGABRT present      /usr/libexec/org_kde_powerdevil                                                                                 2.7M
Wed 2024-06-26 12:36:14 EEST   2302 1000 1000 SIGABRT present      /usr/libexec/org_kde_powerdevil                                                                                 2.7M
Thu 2024-06-20 19:11:45 EEST   2284 1000 1000 SIGABRT present      /usr/libexec/org_kde_powerdevil                                                                                 2.9M

Should I send it all here?
Comment 6 Jakob Petsovits 2024-06-26 19:26:29 UTC
(In reply to ezh from comment #4)
> Is this format OK?

Thanks, that's a good trace. Looking at the code, I wonder if in ddcutil's ddc_close_display() (at ddc/ddc_packet_io.c:373, according to your trace) the hash table is concurrently being accessed from another thread.

That file has a mutex for its `open_displays` global variable (called `open_displays_mutex`) but it's not in use for opening and closing displays. The ddc_open_display() function has a comment "protect with lock?" next to a similar access of the same variable. Our code is setting the brightness from a different thread than the one that was used to initialize ddcutil. I could imagine that powerdevil's brightness setting code is doing something to `open_displays` at the same time as ddcutil's background display/connection monitoring code.

Do you have backtraces of any further threads that might also show ddcutil functions happening simultaneously?
Comment 7 ezh 2024-06-26 20:26:22 UTC
Created attachment 171045 [details]
List of all entries of coredumpctl --reverse

I have those in the list, they all happened in different time.
Comment 8 Nate Graham 2024-06-26 21:59:51 UTC

*** This bug has been marked as a duplicate of bug 489169 ***