Bug 356470

Summary: Plasmashell 5.5 segfaults on shutdown (like 5.3)
Product: [Plasma] plasmashell Reporter: Paul Konecny <paul>
Component: generalAssignee: David Edmundson <kde>
Status: RESOLVED FIXED    
Severity: crash CC: bhush94, lalochcz, plasma-bugs, raghu, sudhir
Priority: NOR    
Version: 5.5.0   
Target Milestone: 1.0   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Backtrace

Description Paul Konecny 2015-12-10 14:07:00 UTC
Created attachment 95975 [details]
Backtrace

Today I got the Arch Update for Plasma 5.5 and everytime I use Kickoff > Quit > Shutdown I get a segfault. This behaviour is quite similar to the segfaults of Plasma 5.3 back in the day. 
It happens on my desktop (AMD HD7970, mesa) as well as on my notebook (Intel HD4400). 
I managed to salvage a hopefully useful backtrace.
Because I'm on Arch I had to rebuild plasma-workspace with debug enabled. If you need more packages with debugging enabled please let me know!
By the way, is there an easy solution to cancel a shutdown? I was lucky I could save this backtrace but most of the time my machine is gone before I can save the output of Dr. Konqi.
Cheers and thanks in advance!
Comment 1 Paul Konecny 2015-12-10 18:25:32 UTC
Happens on logout too.
I'm compiling Qt 5.5 with debugging now. When it's finished I'll get you a more complete trace. 
Cheers!
Comment 2 Raghavendra kamath 2015-12-11 08:36:39 UTC
I get this crash too,

plasma 5.5 arch with nvidia gtx 750ti
Comment 3 David Strobach 2015-12-11 16:21:05 UTC
Same here on both my Arch Linux boxes.
Can be reliably reproduced by kquitapp plasmashell.
Comment 4 David Strobach 2015-12-11 17:08:16 UTC
The value of m_applet in applets/systemtray/plugin/protocols/plasmoid:PlasmoidTask::~PlasmoidTask() is sometimes NULL.
The crash can be "fixed" by simple
    if (m_applet)
        m_applet->destroy();
but I suppose, that the m_applet should not be NULL in the first place.
Comment 5 David Strobach 2015-12-11 17:42:41 UTC
The guilty plasmoid is in my case "org.kde.muonnotifier", which for some reason failed to load, but its task destructor is called at shutdown nevertheless:
invalid fallback path in  ""
could not load plasma applet  "org.kde.muonnotifier" 0
Failed to load Plasmoid:  "org.kde.muonnotifier"

The problem is caused by outdated discovernotifier metadata file in Arch Linux. So it's both, a systemtray applet bug and a distro packaging bug.
Comment 6 David Edmundson 2015-12-12 11:04:30 UTC
Thread 1 (Thread 0x7fc87d127800 (LWP 786)):
[KCrash Handler]
#5  0x00007fc87b36a5f0 in Plasma::Applet::immutability() const () from /usr/lib/libKF5Plasma.so.5
#6  0x00007fc87b36a699 in Plasma::Applet::destroy() () from /usr/lib/libKF5Plasma.so.5
#7  0x00007fc7beece40b in SystemTray::PlasmoidTask::~PlasmoidTask (this=0x2f1e970, __in_chrg=<optimized out>) at /home/paul/rebuild/plasma-workspace/src/plasma-workspace-5.5.0/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.cpp:121
#8  0x00007fc7beece499 in SystemTray::PlasmoidTask::~PlasmoidTask (this=0x2f1e970, __in_chrg=<optimized out>) at /home/paul/rebuild/plasma-workspace/src/plasma-workspace-5.5.0/applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.cpp:122
#9  0x00007fc876ebb60b in QObjectPrivate::deleteChildren() () from /usr/lib/libQt5Core.so.5
#10 0x00007fc876ec5390 in QObject::~QObject() () from /usr/lib/libQt5Core.so.5
#11 0x00007fc7beed1969 in SystemTray::PlasmoidProtocol::~PlasmoidProtocol (this=0x2f910e0, __in_chrg=<optimized out>) at /home/paul/rebuild/plasma-workspace/src/plasma-workspace-5.5.0/applets/systemtray/plugin/protocols/plasmoid/plasmoidprotocol.cpp:58
#12 0x00007fc876ebb60b in QObjectPrivate::deleteChildren() () from /usr/lib/libQt5Core.so.5
#13 0x00007fc876ec5390 in QObject::~QObject() () from /usr/lib/libQt5Core.so.5
#14 0x00007fc7beebf6cb in QQmlPrivate::QQmlElement<SystemTray::Host>::~QQmlElement (this=0x2e15700, __in_chrg=<optimized out>) at /usr/include/qt/QtQml/qqmlprivate.h:98
Comment 7 Paul Konecny 2015-12-15 19:31:24 UTC
I just received the update for plasma-workspace 5.5.1 and the issue seems fixed. 
Neither kquitapp plasmashell nor a normal shutdown trigger the segfault now. 

Can you guys confirm this?
Comment 8 David Strobach 2015-12-21 22:48:20 UTC
(In reply to Paul Konecny from comment #7)
> I just received the update for plasma-workspace 5.5.1 and the issue seems
> fixed. 
> Neither kquitapp plasmashell nor a normal shutdown trigger the segfault now. 
> 
> Can you guys confirm this?

Yes, the broken discovernotifier plasmoid is already fixed, but it only removed the trigger. The bug itself is still there.
Comment 9 David Edmundson 2015-12-25 18:16:12 UTC
Git commit e8c6426ac12c14be68a68b9492274140c28f3285 by David Edmundson.
Committed on 25/12/2015 at 18:16.
Pushed by davidedmundson into branch 'Plasma/5.5'.

Guard against applet failing to load in systemtray task

If an applet fails to load properly m_applet will be null which is a
valid state to be in when we destruct the plasmoid task object.
REVIEW: 126497

M  +3    -1    applets/systemtray/plugin/protocols/plasmoid/plasmoidtask.cpp

http://commits.kde.org/plasma-workspace/e8c6426ac12c14be68a68b9492274140c28f3285