rockowitz / ddcutil

Control monitor settings using DDC/CI and USB
http://www.ddcutil.com
GNU General Public License v2.0
946 stars 38 forks source link

ddcutil 1.3.0 crashes on archlinux #298

Open nishanthkarthik opened 1 year ago

nishanthkarthik commented 1 year ago

This only happens the very first time I try to change the brightness on KDE. Once the powerdevil-ddcutil plugin crashes and reloads, it works as expected. I don't have the debug symbols at the moment.

Stacktrace

#0  0x00007fb25a6a6688 in pthread_sigmask () at /usr/lib/libc.so.6
#1  0x00007fb25a651bdd in sigprocmask () at /usr/lib/libc.so.6
#2  0x00007fb25bc231eb in KCrash::setCrashHandler(void (*)(int)) (handler=handler@entry=0x0) at /usr/src/debug/kcrash/kcrash-5.102.0/src/kcrash.cpp:414
        mask = {__val = {1256, 0, 1, 0, 0, 140403903995488, 6, 8062222200087442176, 140725680788560, 18446744073709551376, 4, 140404020384016, 6, 140403999188864, 140725680788560, 140403997866915}}
#3  0x00007fb25bc257e6 in KCrash::defaultCrashHandler(int) (sig=6) at /usr/src/debug/kcrash/kcrash-5.102.0/src/kcrash.cpp:625
        crashRecursionCounter = 2
#4  0x00007fb25a6519e0 in <signal handler called> () at /usr/lib/libc.so.6
#5  0x00007fb25a6a164c in  () at /usr/lib/libc.so.6
#6  0x00007fb25a651938 in raise () at /usr/lib/libc.so.6
#7  0x00007fb25a63b53d in abort () at /usr/lib/libc.so.6
#8  0x00007fb25a63b45c in  () at /usr/lib/libc.so.6
#9  0x00007fb25a64a486 in  () at /usr/lib/libc.so.6
#10 0x00007fb254090098 in  () at /usr/lib/libddcutil.so.4
#11 0x00007fb254083709 in  () at /usr/lib/libddcutil.so.4
#12 0x00007fb2540894d2 in  () at /usr/lib/libddcutil.so.4
#13 0x00007fb254077236 in  () at /usr/lib/libddcutil.so.4
#14 0x00007fb25407760a in  () at /usr/lib/libddcutil.so.4
#15 0x00007fb254077a9c in  () at /usr/lib/libddcutil.so.4
#16 0x00007fb2540796fe in  () at /usr/lib/libddcutil.so.4
#17 0x00007fb25407b40a in  () at /usr/lib/libddcutil.so.4
#18 0x00007fb2540a262d in ddca_get_non_table_vcp_value () at /usr/lib/libddcutil.so.4
#19 0x00007fb254142ad4 in  () at /usr/lib/qt/plugins/kf5/powerdevil/powerdevilupowerbackend.so
#20 0x00007fb2541356e4 in PowerDevilUPowerBackend::brightness(PowerDevil::BackendInterface::BrightnessControlType) const () at /usr/lib/qt/plugins/kf5/powerdevil/powerdevilupowerbackend.so
#21 0x00007fb254135cd7 in PowerDevilUPowerBackend::setBrightness(int, PowerDevil::BackendInterface::BrightnessControlType) () at /usr/lib/qt/plugins/kf5/powerdevil/powerdevilupowerbackend.so
#22 0x00007fb25411811d in  () at /usr/lib/qt/plugins/powerdevil/action/powerdevil_brightnesscontrolaction.so
#23 0x00007fb2541186c6 in  () at /usr/lib/qt/plugins/powerdevil/action/powerdevil_brightnesscontrolaction.so
#24 0x00007fb25411a881 in  () at /usr/lib/qt/plugins/powerdevil/action/powerdevil_brightnesscontrolaction.so
#25 0x00007fb25b9fd45f in  () at /usr/lib/libQt5DBus.so.5
#26 0x00007fb25b9c3a44 in  () at /usr/lib/libQt5DBus.so.5
#27 0x00007fb25b9c4719 in  () at /usr/lib/libQt5DBus.so.5
#28 0x00007fb25b9c475c in  () at /usr/lib/libQt5DBus.so.5
#29 0x00007fb25aeb1a70 in QObject::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#30 0x00007fb25ae8de08 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#31 0x00007fb25ae8e913 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () at /usr/lib/libQt5Core.so.5
#32 0x00007fb25aed4d48 in  () at /usr/lib/libQt5Core.so.5
#33 0x00007fb259c6e82b in g_main_dispatch (context=0x7fb250005010) at ../glib/glib/gmain.c:3454
        dispatch = 0x7fb25aed4d30
        prev_source = 0x0
        begin_time_nsec = 51412578135
        was_in_call = 0
        user_data = 0x0
        callback = 0x0
        cb_funcs = 0x0
        cb_data = 0x0
        need_destroy = <optimized out>
        source = 0x55d17086b470
        current = 0x55d17094fb00
        i = 0
#34 g_main_context_dispatch (context=0x7fb250005010) at ../glib/glib/gmain.c:4172
#35 0x00007fb259cc5cc9 in g_main_context_iterate.constprop.0 (context=0x7fb250005010, block=1, dispatch=1, self=<optimized out>) at ../glib/glib/gmain.c:4248
        max_priority = 2147483647
        timeout = 12590
        some_ready = 1
        nfds = 5
        allocated_nfds = <optimized out>
        fds = <optimized out>
        begin_time_nsec = 51410125355
#36 0x00007fb259c6d0e2 in g_main_context_iteration (context=0x7fb250005010, may_block=1) at ../glib/glib/gmain.c:4313
        retval = <optimized out>
#37 0x00007fb25aed8b2c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#38 0x00007fb25ae865ac in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#39 0x00007fb25ae910d9 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#40 0x000055d1706121e8 in  ()
#41 0x00007fb25a63c290 in  () at /usr/lib/libc.so.6
#42 0x00007fb25a63c34a in __libc_start_main () at /usr/lib/libc.so.6
#43 0x000055d170612255 in  ()

ddcutil.log

rockowitz commented 1 year ago

That the plugin fails on first use, but works after reload, suggests that there are two different versions of the plugin. I'm not familiar with the plugin framework, but you might check if there are two copies of powerdevilupowerbackend.so on your system. The PowerDevil plugin is marginal, and most (all?) binary distributions do not build it with ddcutil enabled. arch is a source distribution, and it appears that normal practice is to build with all options enabled.

See this comment on an earlier issue thread from the person who implemented the PowerDevel/ddcutil code.

Alternatively, there might be an old copy of libddcutil.so that is being called first.

Note that code simplification in ddcutil 1.3 exposed a bug in the coding of the Nvidia proprietary driver. Release 1.4 backs out that simplification as a workaround. See the ddcutil release notes. However, it does not appear that this is the source of your problem.

Having said all that, ddcutil should not be going belly up because the API is misused. To capture libddcutil tracing, create file $HOME/.config/ddcutil/ddcutilrc with the following lines:

[libddcutil]
options: --thread-id --trace ddc --trace i2c --libddcutil-trace-file <YOUR_FILENAME_HERE> 

To include debug symbols in libddcutil.so, call .configure as follows before make:

./configure CFLAGS="-ggdb3 -O0" CXXFLAGS="-ggdb3 -O0" LDFLAGS="-ggdb3"

It would also be useful to see if the problem still occurs when building from the current 1.4.1-release branch.

And of course, please submit any large output as an attachment of some sort rather than inline. Thank you.