Bug 375298

Summary: Crashes once in a while
Product: [Plasma] plasmashell Reporter: Dmitry Osipenko <digetx>
Component: Networks widgetAssignee: Jan Grulich <jgrulich>
Status: RESOLVED FIXED    
Severity: normal CC: jgrulich
Priority: NOR    
Version First Reported In: master   
Target Milestone: 1.0   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Patch to fix the crash in notifications
valgrind log
Crash fix
Crash fix V2

Description Dmitry Osipenko 2017-01-19 14:53:02 UTC
The plasma-nm widget segfaults, causing the kded5 to crash. It looks like it crashes after several network connects/disconnects, but I'm not sure.

#0  operator== (s1=..., s2=...) at tools/qstring.cpp:2746                                                                          
#1  0x00007fffea0a484c in KNotification::setText (this=this@entry=0xa26610, text=...) at /var/tmp/portage/kde-frameworks/knotifications-5.30.0/work/knotifications-5.30.0/src/knotification.cpp:152
#2  0x00007fffdd5e5b60 in Notification::stateChanged (this=0x8a5800, newstate=<optimized out>, oldstate=<optimized out>, reason=<optimized out>) at /var/tmp/portage/kde-plasma/plasma-nm-5.8.5/work/plasma-nm-5.8.5/kded/notification.cpp:336
#3  0x00007ffff5f60d32 in QtPrivate::QSlotObjectBase::call (a=0x7fffffffc5b0, r=0x8a5800, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobject_impl.h:101
#4  QMetaObject::activate (sender=0x8f0ec0, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffc5b0) at kernel/qobject.cpp:3723
#5  0x00007ffff5f61377 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7fffdd0d2a80 <NetworkManager::Device::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffc5b0) at kernel/qobject.cpp:3602
#6  0x00007fffdce8543a in NetworkManager::Device::stateChanged (this=<optimized out>, _t1=NetworkManager::Device::Failed, _t2=NetworkManager::Device::ConfiguringIp, _t3=NetworkManager::Device::ConfigUnavailableReason)
    at /var/tmp/portage/kde-frameworks/networkmanager-qt-5.30.0/work/networkmanager-qt-5.30.0_build/src/KF5NetworkManagerQt_automoc.dir/moc_device_RSSED7JB6XRE6D.cpp:638
#7  0x00007ffff5f60d32 in QtPrivate::QSlotObjectBase::call (a=0x7fffffffc740, r=0xa33850, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobject_impl.h:101
#8  QMetaObject::activate (sender=sender@entry=0xa33860, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffc740) at kernel/qobject.cpp:3723
#9  0x00007ffff5f61377 in QMetaObject::activate (sender=sender@entry=0xa33860, m=m@entry=0x7fffdd0d2dc0 <OrgFreedesktopNetworkManagerDeviceInterface::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffffffc740)
    at kernel/qobject.cpp:3602                                                                                                                                     
#10 0x00007fffdce8f698 in OrgFreedesktopNetworkManagerDeviceInterface::StateChanged (_t3=5, _t2=70, _t1=120, this=0xa33860)                                        
    at /var/tmp/portage/kde-frameworks/networkmanager-qt-5.30.0/work/networkmanager-qt-5.30.0_build/src/KF5NetworkManagerQt_automoc.dir/moc_nm-deviceinter_6D2ZNZE74E76EK.cpp:284
#11 OrgFreedesktopNetworkManagerDeviceInterface::qt_static_metacall (_o=_o@entry=0xa33860, _c=_c@entry=QMetaObject::InvokeMetaMethod, _id=_id@entry=0, _a=_a@entry=0x7fffffffc8c0)
    at /var/tmp/portage/kde-frameworks/networkmanager-qt-5.30.0/work/networkmanager-qt-5.30.0_build/src/KF5NetworkManagerQt_automoc.dir/moc_nm-deviceinter_6D2ZNZE74E76EK.cpp:149          
#12 0x00007fffdce950e0 in OrgFreedesktopNetworkManagerDeviceInterface::qt_metacall (this=0xa33860, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffffffc8c0)                             
    at /var/tmp/portage/kde-frameworks/networkmanager-qt-5.30.0/work/networkmanager-qt-5.30.0_build/src/KF5NetworkManagerQt_automoc.dir/moc_nm-deviceinter_6D2ZNZE74E76EK.cpp:253          
#13 0x00007ffff7f37393 in QDBusConnectionPrivate::deliverCall (this=<optimized out>, object=<optimized out>, msg=..., metaTypes=..., slotIdx=<optimized out>) at qdbusintegrator.cpp:995   
#14 0x00007ffff5f61b71 in QObject::event (this=0xa33860, e=<optimized out>) at kernel/qobject.cpp:1263                                                                                     
#15 0x00007ffff7328a9c in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0xa33860, e=0x7fffd80111b0) at kernel/qapplication.cpp:3799                                   
#16 0x00007ffff7330446 in QApplication::notify (this=0x7fffffffcfb0, receiver=0xa33860, e=0x7fffd80111b0) at kernel/qapplication.cpp:3556                                                  
#17 0x00007ffff5f3a67a in QCoreApplication::notifyInternal2 (receiver=0xa33860, event=event@entry=0x7fffd80111b0) at kernel/qcoreapplication.cpp:988                                       
#18 0x00007ffff5f3ccfb in QCoreApplication::sendEvent (event=0x7fffd80111b0, receiver=<optimized out>) at kernel/qcoreapplication.h:231                                                    
#19 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x619eb0) at kernel/qcoreapplication.cpp:1649                                                                                                         
#20 0x00007ffff5f3d168 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1503                                                                                                         
#21 0x00007ffff5f878c3 in postEventSourceDispatch (s=0x66bbf0) at kernel/qeventdispatcher_glib.cpp:276                                                                                                                                                                
#22 0x00007ffff2f01457 in g_main_dispatch (context=0x7fffe40016f0) at /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gmain.c:3203                                                                                                                        
#23 g_main_context_dispatch (context=context@entry=0x7fffe40016f0) at /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gmain.c:3856                                                                                                                        
#24 0x00007ffff2f016b0 in g_main_context_iterate (context=context@entry=0x7fffe40016f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gmain.c:3929                             
#25 0x00007ffff2f0175c in g_main_context_iteration (context=0x7fffe40016f0, may_block=may_block@entry=1) at /var/tmp/portage/dev-libs/glib-2.50.2/work/glib-2.50.2/glib/gmain.c:3990                                                                                  
#26 0x00007ffff5f8793f in QEventDispatcherGlib::processEvents (this=0x6798b0, flags=...) at kernel/qeventdispatcher_glib.cpp:423                                                                                                                                      
#27 0x00007ffff5f3963a in QEventLoop::exec (this=this@entry=0x7fffffffce80, flags=..., flags@entry=...) at kernel/qeventloop.cpp:212                                                                                                                                  
#28 0x00007ffff5f4103c in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1261                                                                                                                                                                               
#29 0x00007ffff67593cc in QGuiApplication::exec () at kernel/qguiapplication.cpp:1633                                                                                                                                                                                 
#30 0x00007ffff73289f5 in QApplication::exec () at kernel/qapplication.cpp:2975                                                                                                                                                                                       
#31 0x00007ffff7bd2463 in kdemain (argc=1, argv=<optimized out>) at /var/tmp/portage/kde-frameworks/kded-5.30.0/work/kded-5.30.0/src/kded.cpp:792                                                                                                                     
#32 0x00007ffff784d670 in __libc_start_main (main=0x400650 <main(int, char**)>, argc=1, argv=0x7fffffffd168, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffd158) at ../csu/libc-start.c:289                              
#33 0x0000000000400689 in _start ()
Comment 1 Jan Grulich 2017-01-20 08:34:46 UTC
Created attachment 103557 [details]
Patch to fix the crash in notifications

Can you please try attached patch? Then you need to restart kded5 to load the fixed kded module.
Comment 2 Dmitry Osipenko 2017-01-20 11:09:50 UTC
(In reply to Jan Grulich from comment #1)
> Created attachment 103557 [details]
> Patch to fix the crash in notifications
> 
> Can you please try attached patch? Then you need to restart kded5 to load
> the fixed kded module.

Thank you a lot, Jan! I've applied the patch and will run with it for a while, since I don't know of a way to trigger the crash, it's quite sporadic. If you won't hear anything from me in a week or more, you may assume that it fixed the issue; otherwise I'll report back.
Comment 3 Dmitry Osipenko 2017-01-20 11:50:34 UTC
Created attachment 103560 [details]
valgrind log

Still crashes :(

Now, I ran kded5 under valgrind and here the splat (full log attached):

networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "LldpNeighbors"
networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "Real"
networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "LldpNeighbors"
networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "Real"
networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "S390Subchannels"
networkmanager-qt: void NetworkManager::NetworkManagerPrivate::propertiesChanged(const QVariantMap&) Unhandled property "AllDevices"
networkmanager-qt: void NetworkManager::NetworkManagerPrivate::propertiesChanged(const QVariantMap&) Unhandled property "Devices"
QObject::connect: invalid null parameter
plasma-nm: Unhandled active connection state change:  1
networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "RxBytes"
networkmanager-qt: virtual void NetworkManager::DevicePrivate::propertyChanged(const QString&, const QVariant&) Unhandled property "TxBytes"
plasma-nm: Unhandled active connection state change:  1
==20053== 
==20053== HEAP SUMMARY:
==20053==     in use at exit: 4,002,347 bytes in 30,746 blocks
==20053==   total heap usage: 416,618 allocs, 385,872 frees, 62,859,846 bytes allocated
==20053== 
==20053== LEAK SUMMARY:
==20053==    definitely lost: 8,259 bytes in 52 blocks
==20053==    indirectly lost: 7,808 bytes in 133 blocks
==20053==      possibly lost: 0 bytes in 0 blocks
==20053==    still reachable: 3,986,280 bytes in 30,561 blocks
==20053==                       of which reachable via heuristic:
==20053==                         newarray           : 816 bytes in 21 blocks
==20053==                         multipleinheritance: 168 bytes in 1 blocks
==20053==         suppressed: 0 bytes in 0 blocks
==20053== Rerun with --leak-check=full to see details of leaked memory
==20053== 
==20053== For counts of detected and suppressed errors, rerun with: -v
==20053== Use --track-origins=yes to see where uninitialised values come from
==20053== ERROR SUMMARY: 392 errors from 24 contexts (suppressed: 0 from 0)
==20060== 
==20060== HEAP SUMMARY:
==20060==     in use at exit: 4,005,018 bytes in 30,805 blocks
==20060==   total heap usage: 418,612 allocs, 387,807 frees, 63,164,098 bytes allocated
==20060== 
==20060== LEAK SUMMARY:
==20060==    definitely lost: 8,347 bytes in 53 blocks
==20060==    indirectly lost: 8,636 bytes in 147 blocks
==20060==      possibly lost: 0 bytes in 0 blocks
==20060==    still reachable: 3,988,035 bytes in 30,605 blocks
==20060==                       of which reachable via heuristic:
==20060==                         newarray           : 816 bytes in 21 blocks
==20060==                         multipleinheritance: 168 bytes in 1 blocks
==20060==         suppressed: 0 bytes in 0 blocks
==20060== Rerun with --leak-check=full to see details of leaked memory
==20060== 
==20060== For counts of detected and suppressed errors, rerun with: -v
==20060== Use --track-origins=yes to see where uninitialised values come from
==20060== ERROR SUMMARY: 392 errors from 24 contexts (suppressed: 0 from 0)
Initializing  "kcm_input" :  "kcminit_mouse"
Initializing  "kcm_input" :  "kcminit_mouse"
==7231== Thread 1:
==7231== Invalid read of size 8
==7231==    at 0x12D4883C: KNotification::setText(QString const&) (knotification.cpp:152)
==7231==    by 0x1C3F3B64: Notification::stateChanged(NetworkManager::Device::State, NetworkManager::Device::State, NetworkManager::Device::StateChangeReason) (notification.cpp:337)
==7231==    by 0x6D01D31: call (qobject_impl.h:101)
==7231==    by 0x6D01D31: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3723)
==7231==    by 0x1CC01439: NetworkManager::Device::stateChanged(NetworkManager::Device::State, NetworkManager::Device::State, NetworkManager::Device::StateChangeReason) (moc_device_RSSED7JB6XRE6D.cpp:638)
==7231==    by 0x6D01D31: call (qobject_impl.h:101)
==7231==    by 0x6D01D31: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3723)
==7231==    by 0x1CC0B697: StateChanged (moc_nm-deviceinter_6D2ZNZE74E76EK.cpp:284)
==7231==    by 0x1CC0B697: OrgFreedesktopNetworkManagerDeviceInterface::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_nm-deviceinter_6D2ZNZE74E76EK.cpp:149)
==7231==    by 0x1CC110DF: OrgFreedesktopNetworkManagerDeviceInterface::qt_metacall(QMetaObject::Call, int, void**) (moc_nm-deviceinter_6D2ZNZE74E76EK.cpp:253)
==7231==    by 0x409C392: QDBusConnectionPrivate::deliverCall(QObject*, int, QDBusMessage const&, QVector<int> const&, int) (qdbusintegrator.cpp:995)
==7231==    by 0x6D02B70: QObject::event(QEvent*) (qobject.cpp:1263)
==7231==    by 0x553DA9B: QApplicationPrivate::notify_helper(QObject*, QEvent*) (qapplication.cpp:3799)
==7231==    by 0x5545445: QApplication::notify(QObject*, QEvent*) (qapplication.cpp:3556)
==7231==    by 0x6CDB679: QCoreApplication::notifyInternal2(QObject*, QEvent*) (qcoreapplication.cpp:988)
==7231==  Address 0x1adf2310 is 16 bytes inside a block of size 24 free'd
==7231==    at 0x4C2C62B: operator delete(void*) (vg_replace_malloc.c:576)
==7231==    by 0x6D02BA7: QObject::event(QEvent*) (qobject.cpp:1254)
==7231==    by 0x553DA9B: QApplicationPrivate::notify_helper(QObject*, QEvent*) (qapplication.cpp:3799)
==7231==    by 0x5545445: QApplication::notify(QObject*, QEvent*) (qapplication.cpp:3556)
==7231==    by 0x6CDB679: QCoreApplication::notifyInternal2(QObject*, QEvent*) (qcoreapplication.cpp:988)
==7231==    by 0x6CDDCFA: sendEvent (qcoreapplication.h:231)
==7231==    by 0x6CDDCFA: QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) (qcoreapplication.cpp:1649)
==7231==    by 0x6D288C2: postEventSourceDispatch(_GSource*, int (*)(void*), void*) (qeventdispatcher_glib.cpp:276)
==7231==    by 0x9A8F456: g_main_dispatch (gmain.c:3203)
==7231==    by 0x9A8F456: g_main_context_dispatch (gmain.c:3856)
==7231==    by 0x9A8F6AF: g_main_context_iterate.isra.29 (gmain.c:3929)
==7231==    by 0x9A8F75B: g_main_context_iteration (gmain.c:3990)
==7231==    by 0x6D2893E: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventdispatcher_glib.cpp:423)
==7231==    by 0x6CDA639: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:212)
==7231==  Block was alloc'd at
==7231==    at 0x4C2B56F: operator new(unsigned long) (vg_replace_malloc.c:334)
==7231==    by 0x1C3F3D80: Notification::stateChanged(NetworkManager::Device::State, NetworkManager::Device::State, NetworkManager::Device::StateChangeReason) (notification.cpp:341)
==7231==    by 0x6D01D31: call (qobject_impl.h:101)
==7231==    by 0x6D01D31: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3723)
==7231==    by 0x1CC01439: NetworkManager::Device::stateChanged(NetworkManager::Device::State, NetworkManager::Device::State, NetworkManager::Device::StateChangeReason) (moc_device_RSSED7JB6XRE6D.cpp:638)
==7231==    by 0x6D01D31: call (qobject_impl.h:101)
==7231==    by 0x6D01D31: QMetaObject::activate(QObject*, int, int, void**) (qobject.cpp:3723)
==7231==    by 0x1CC0B697: StateChanged (moc_nm-deviceinter_6D2ZNZE74E76EK.cpp:284)
==7231==    by 0x1CC0B697: OrgFreedesktopNetworkManagerDeviceInterface::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_nm-deviceinter_6D2ZNZE74E76EK.cpp:149)
==7231==    by 0x1CC110DF: OrgFreedesktopNetworkManagerDeviceInterface::qt_metacall(QMetaObject::Call, int, void**) (moc_nm-deviceinter_6D2ZNZE74E76EK.cpp:253)
==7231==    by 0x409C392: QDBusConnectionPrivate::deliverCall(QObject*, int, QDBusMessage const&, QVector<int> const&, int) (qdbusintegrator.cpp:995)
==7231==    by 0x6D02B70: QObject::event(QEvent*) (qobject.cpp:1263)
==7231==    by 0x553DA9B: QApplicationPrivate::notify_helper(QObject*, QEvent*) (qapplication.cpp:3799)
==7231==    by 0x5545445: QApplication::notify(QObject*, QEvent*) (qapplication.cpp:3556)
==7231==    by 0x6CDB679: QCoreApplication::notifyInternal2(QObject*, QEvent*) (qcoreapplication.cpp:988)
==7231==
Comment 4 Dmitry Osipenko 2017-01-20 15:49:18 UTC
Created attachment 103562 [details]
Crash fix

I had some time to look at the code, the attached patch fixes the issue for me.
Comment 5 Jan Grulich 2017-01-23 08:24:54 UTC
The patch looks good to me, can you push it? If you don't have developer access I can do it instead of you. Thank you.
Comment 6 Dmitry Osipenko 2017-01-23 10:24:33 UTC
Created attachment 103598 [details]
Crash fix V2

(In reply to Jan Grulich from comment #5)
> The patch looks good to me, can you push it? If you don't have developer
> access I can do it instead of you. Thank you.

I'm not a KDE developer, so it would be nice if you could pick up the patch from here directly and apply it, thanks in advance. I have attached V2 of the patch with a better commit title and removed file permission change.

With the patch being applied, I think you may mark this bug as resolved :-)
Comment 7 Jan Grulich 2017-01-23 11:51:05 UTC
Fixed in Plasma 5.8.6 and Plasma 5.9.
Comment 8 Ben Cooksley 2024-12-23 18:26:02 UTC
Bulk transfer as requested in T17796