Bug 331719 - Kalarm crashes randomly at startup
Summary: Kalarm crashes randomly at startup
Status: CLOSED FIXED
Alias: None
Product: kalarm
Classification: Applications
Component: general (show other bugs)
Version: 2.10.6-ak
Platform: Ubuntu Linux
: NOR crash
Target Milestone: ---
Assignee: David Jarvie
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-04 02:13 UTC by Jussi
Modified: 2020-08-17 23:45 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.12.4


Attachments
Debug messages (87.56 KB, text/plain)
2014-03-05 14:09 UTC, Jussi
Details
My startup script for Kalarm (82 bytes, application/x-sh)
2014-03-06 20:31 UTC, Jussi
Details
Kalarm session restore files (2.01 KB, application/gzip)
2014-03-06 20:36 UTC, Jussi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jussi 2014-03-04 02:13:03 UTC
Kalarm crashes randomly at startup (boot up), but never crashes again when restarted.

Reproducible: Sometimes

Steps to Reproduce:
1. Reboot.
Actual Results:  
Segmentation fault

Expected Results:  
No segmentation faults.

Problem occurs on Xubuntu 13.10 64 bit and there was also problems with earlier versions of Ubuntu (also 64 bit). I use script to delay start of Kalarm (sleep command), which may explain why it doesn't crash every time. I suspect race condition.

Application: KAlarm (kalarm), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f26a6ce77c0 (LWP 2354))]

Thread 3 (Thread 0x7f268b52e700 (LWP 2389)):
#0  0x00007f26a14c9f7d in poll () at ../sysdeps/unix/syscall-template.S:81
#1  0x00007f269bd236a4 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f269bd23b0a in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f2691b8fb66 in ?? () from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0
#4  0x00007f269bd480f5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f269d5b5f6e in start_thread (arg=0x7f268b52e700) at pthread_create.c:311
#6  0x00007f26a14d69cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 2 (Thread 0x7f268a431700 (LWP 2397)):
#0  0x00007f269d5b8055 in __GI___pthread_mutex_lock (mutex=0x1b2e790) at pthread_mutex_lock.c:95
#1  0x00007f269bd633a1 in g_mutex_lock () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f269bd22c17 in g_main_context_prepare () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f269bd235c3 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f269bd237ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f269bd237f9 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#6  0x00007f269bd480f5 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#7  0x00007f269d5b5f6e in start_thread (arg=0x7f268a431700) at pthread_create.c:311
#8  0x00007f26a14d69cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 1 (Thread 0x7f26a6ce77c0 (LWP 2354)):
[KCrash Handler]
#6  0x00000000004ddda2 in TrayWindow::TrayWindow (this=0x1c87b10, parent=<optimized out>) at ../../kalarm/traywindow.cpp:131
#7  0x0000000000499804 in KAlarmApp::displayTrayIcon (this=0x198e520, show=show@entry=true, parent=<optimized out>, parent@entry=0x1a302a0) at ../../kalarm/kalarmapp.cpp:964
#8  0x00000000004ae68d in MainWindow::MainWindow (this=this@entry=0x1a302a0, restored=restored@entry=false, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at ../../kalarm/mainwindow.cpp:225
#9  0x00000000004ae9e9 in MainWindow::create (restored=restored@entry=false) at ../../kalarm/mainwindow.cpp:140
#10 0x00000000004a12b9 in KAlarmApp::newInstance (this=0x198e520) at ../../kalarm/kalarmapp.cpp:525
#11 0x00007f26a37b5ccc in KUniqueApplicationAdaptor::newInstance (this=0x1bf3440, asn_id=..., args=...) at ../../kdeui/kernel/kuniqueapplication.cpp:442
#12 0x00007f26a37b5d55 in KUniqueApplicationAdaptor::qt_static_metacall (_o=_o@entry=0x1bf3440, _id=_id@entry=0, _a=_a@entry=0x7fff7ad3c880, _c=QMetaObject::InvokeMetaMethod) at ./kuniqueapplication_p.moc:58
#13 0x00007f26a37b5f73 in qt_static_metacall (_a=0x7fff7ad3c880, _id=0, _c=QMetaObject::InvokeMetaMethod, _o=0x1bf3440) at ./kuniqueapplication_p.moc:101
#14 KUniqueApplicationAdaptor::qt_metacall (this=0x1bf3440, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fff7ad3c880) at ./kuniqueapplication_p.moc:102
#15 0x00007f26a2e74e36 in QDBusConnectionPrivate::deliverCall (this=this@entry=0x1967860, object=object@entry=0x1bf3440, msg=..., metaTypes=..., slotIdx=4) at qdbusintegrator.cpp:951
#16 0x00007f26a2e75f8b in QDBusConnectionPrivate::activateCall (this=this@entry=0x1967860, object=0x1bf3440, flags=flags@entry=337, msg=...) at qdbusintegrator.cpp:863
#17 0x00007f26a2e7699d in QDBusConnectionPrivate::activateObject (this=0x1967860, node=..., msg=..., pathStartPos=<optimized out>) at qdbusintegrator.cpp:1427
#18 0x00007f26a2e76a6b in QDBusActivateObjectEvent::placeMetaCall (this=0x1c5d660) at qdbusintegrator.cpp:1541
#19 0x00007f26a2b02dce in QObject::event (this=this@entry=0x198e520, e=e@entry=0x1c5d660) at kernel/qobject.cpp:1194
#20 0x00007f26a2aeefdc in QCoreApplication::event (this=this@entry=0x198e520, e=e@entry=0x1c5d660) at kernel/qcoreapplication.cpp:1758
#21 0x00007f26a1e8cea3 in QApplication::event (this=0x198e520, e=0x1c5d660) at kernel/qapplication.cpp:2549
#22 0x00007f26a1e87dfc in QApplicationPrivate::notify_helper (this=this@entry=0x19a65b0, receiver=receiver@entry=0x198e520, e=e@entry=0x1c5d660) at kernel/qapplication.cpp:4567
#23 0x00007f26a1e8e470 in QApplication::notify (this=this@entry=0x198e520, receiver=receiver@entry=0x198e520, e=e@entry=0x1c5d660) at kernel/qapplication.cpp:4353
#24 0x00007f26a37aea6a in KApplication::notify (this=0x198e520, receiver=0x198e520, event=0x1c5d660) at ../../kdeui/kernel/kapplication.cpp:311
#25 0x00007f26a2aea8bd in QCoreApplication::notifyInternal (this=0x198e520, receiver=receiver@entry=0x198e520, event=event@entry=0x1c5d660) at kernel/qcoreapplication.cpp:946
#26 0x00007f26a2aede1f in sendEvent (event=0x1c5d660, receiver=0x198e520) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#27 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x1944de0) at kernel/qcoreapplication.cpp:1570
#28 0x00007f26a2aee2c3 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1463
#29 0x00007f26a2b18073 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#30 postEventSourceDispatch (s=0x19a5c30) at kernel/qeventdispatcher_glib.cpp:279
#31 0x00007f269bd233b6 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007f269bd23708 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007f269bd237ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007f26a2b17a55 in QEventDispatcherGlib::processEvents (this=0x1999ef0, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#35 0x00007f26a1f299d6 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#36 0x00007f26a2ae95ef in QEventLoop::processEvents (this=this@entry=0x7fff7ad3d1a0, flags=...) at kernel/qeventloop.cpp:149
#37 0x00007f26a2ae98e5 in QEventLoop::exec (this=this@entry=0x7fff7ad3d1a0, flags=...) at kernel/qeventloop.cpp:204
#38 0x00007f26a2aeee5b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#39 0x00007f26a1e8634c in QApplication::exec () at kernel/qapplication.cpp:3828
#40 0x000000000044d4a4 in main (argc=3, argv=0x7fff7ad3e048) at ../../kalarm/main.cpp:131
Comment 1 David Jarvie 2014-03-04 15:00:11 UTC
To help investigate the cause of this crash, can you please capture debug output from KAlarm into a file, using the following method:

1) Run 'kdebugdialog --fullmode' and select each of
   5950 kalarm
   5952 akonadiresource (kalarm)
   5955 kdepimlibs (kalarmcal)

2) For each one, select Output to File for each of debug, warning and error,
and set the same filename for each level.

3) The next time KAlarm crashes, attach the debug file to this bug.

4) Run 'kdebugdialog --fullmode' again to revert the output to its old
destination (to avoid filling up the file needlessly), and delete the debug file.
Comment 2 Jussi 2014-03-05 14:09:47 UTC
Created attachment 85421 [details]
Debug messages
Comment 3 David Jarvie 2014-03-06 00:35:03 UTC
Thanks for the debug output. What is happening is that the KDE session restoration is restoring KAlarm, except that it seems to have no windows to restore (either main window or message window) and is therefore starting to close stuff down in order to exit, but it is then being activated in the normal way before it actually exits. In this state, it isn't reinitialising the closed stuff (e.g. alarm calendar), which causes the crash when it tries to use the alarm calendar. I'm trying to reproduce this circumstance so that I can test a fix.
Comment 4 Jussi 2014-03-06 01:39:18 UTC
What launches "KDE session restoration"? Previous error, perhaps in shutdown? Any other logs that would help you? 
Or is it build just for convenience? If so, can I disable it, and without ill effects? It doesn't sound like something I need.
Comment 5 David Jarvie 2014-03-06 11:02:53 UTC
Session restoration is what restores your previous KDE session after you log out and log back in again. It restarts the same applications as were running before you logged out. It can be configured in System Settings, under Startup and Shutdown - you can either restore your previous session, start out with an empty session or start with a fixed saved session each time you log in. Which you choose is just a matter of personal choice and convenience. Note that KAlarm will start up after login regardless of the session restoration setting - the only difference is that if you don't use session restoration, alarm reminder windows which were open when you logged out won't be restored at login.

I've been unable to reproduce the crash here. Could you please attach a copy of KAlarm's session restoration configuration file after the crash occurs. This is the file whose name starts with ~/.kde/share/config/session/kalarm_ . (Sometimes there can be more than one such file - in this case, please attach all of them.)
Comment 6 Jussi 2014-03-06 20:31:57 UTC
Created attachment 85456 [details]
My startup script for Kalarm
Comment 7 Jussi 2014-03-06 20:35:30 UTC
Note that I don't use KDE desktop. And Kalarm doesn't start automatically at login, despite of its configuration is set to do so. See attached startup script. With it Kalarm crashes rarely.
Comment 8 Jussi 2014-03-06 20:36:05 UTC
Created attachment 85457 [details]
Kalarm session restore files
Comment 9 David Jarvie 2014-03-14 17:42:13 UTC
I tried running an Xfce session with your script being autostarted. KAlarm crashed once, but didn't produce any crash dump, so I can't be sure whether it was the same crash as you have seen. I also failed to get it to output debug information (strange!). I've put in a fix which will be in KDE 4.12.4 which I think should prevent the crash, but because of the difficulties in reproducing the crash, can't be sure if it has fixed it.

Please note that to start KAlarm automatically when you log in, you should autostart it with kalarmautostart (do NOT run kalarm directly). See the KAlarm handbook for detailed instructions. For example, to run KAlarm in the command line, use the command:

kalarmautostart kalarm --tray

I'm marking the bug as fixed, but please reopen it if it still crashes in KDE 4.12.4 or later. If you are able to build from source, I can provide a patch for you to test it now.