Bug 329063

Summary: KMail crashes after quitting and restarting
Product: [Applications] kmail2 Reporter: Saurav Sengupta <sauravsgs>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED DUPLICATE    
Severity: crash Keywords: drkonqi
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Saurav Sengupta 2013-12-21 07:10:30 UTC
Application: kmail (4.12)
KDE Platform Version: 4.12.0
Qt Version: 4.8.4
Operating System: Linux 3.11.0-14-generic x86_64
Distribution: Ubuntu 13.10

-- Information about the crash:
- What I was doing when the application crashed:

I had started KMail after logging into my system. The first time KMail starts up correctly. Then I quit KMail and immediately after that I tried starting KMail again but instead of starting, the application crashed right away. The crash always occurs while trying to start KMail a second time in this way, irrespective of what I was doing in KMail when I had started it the first time. During the first run, there were no hangs, freezes or lags in my usage of the application.

The crash can be reproduced every time.

-- Backtrace:
Application: KMail (kmail), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f30c7640800 (LWP 2215))]

Thread 6 (Thread 0x7f309fab4700 (LWP 2221)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f30b84701cd in ?? () from /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4
#2  0x00007f30b8470209 in ?? () from /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4
#3  0x00007f30c225af6e in start_thread (arg=0x7f309fab4700) at pthread_create.c:311
#4  0x00007f30c49949cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 5 (Thread 0x7f309e123700 (LWP 2223)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1  0x00007f30b81b0bbd in ?? () from /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4
#2  0x00007f30b849fa76 in ?? () from /usr/lib/x86_64-linux-gnu/libQtWebKit.so.4
#3  0x00007f30c225af6e in start_thread (arg=0x7f309e123700) at pthread_create.c:311
#4  0x00007f30c49949cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 4 (Thread 0x7f309ca63700 (LWP 2229)):
#0  0x00007f30bc3b80ea in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007f30bc3b83c9 in g_mutex_unlock () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f30bc377d40 in g_main_context_prepare () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f30bc3785c3 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f30bc3787ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f30c5323a76 in QEventDispatcherGlib::processEvents (this=0x7f30400008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#6  0x00007f30c52f55ef in QEventLoop::processEvents (this=this@entry=0x7f309ca62d70, flags=...) at kernel/qeventloop.cpp:149
#7  0x00007f30c52f58e5 in QEventLoop::exec (this=this@entry=0x7f309ca62d70, flags=...) at kernel/qeventloop.cpp:204
#8  0x00007f30c51f488f in QThread::exec (this=<optimized out>) at thread/qthread.cpp:542
#9  0x00007f30c51f6f2f in QThreadPrivate::start (arg=0x1da0520) at thread/qthread_unix.cpp:338
#10 0x00007f30c225af6e in start_thread (arg=0x7f309ca63700) at pthread_create.c:311
#11 0x00007f30c49949cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 3 (Thread 0x7f3057134700 (LWP 2232)):
#0  0x00007f30bc3b80ea in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007f30bc3b8399 in g_mutex_lock () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f30bc37812c in g_main_context_check () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f30bc37863b in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f30bc3787ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#5  0x00007f30c5323a76 in QEventDispatcherGlib::processEvents (this=0x7f30440008c0, flags=...) at kernel/qeventdispatcher_glib.cpp:426
#6  0x00007f30c52f55ef in QEventLoop::processEvents (this=this@entry=0x7f3057133d30, flags=...) at kernel/qeventloop.cpp:149
#7  0x00007f30c52f58e5 in QEventLoop::exec (this=this@entry=0x7f3057133d30, flags=...) at kernel/qeventloop.cpp:204
#8  0x00007f30c51f488f in QThread::exec (this=this@entry=0x238b920) at thread/qthread.cpp:542
#9  0x00007f30c52d6d13 in QInotifyFileSystemWatcherEngine::run (this=0x238b920) at io/qfilesystemwatcher_inotify.cpp:265
#10 0x00007f30c51f6f2f in QThreadPrivate::start (arg=0x238b920) at thread/qthread_unix.cpp:338
#11 0x00007f30c225af6e in start_thread (arg=0x7f3057134700) at pthread_create.c:311
#12 0x00007f30c49949cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 2 (Thread 0x7f309d4c5700 (LWP 2242)):
#0  pthread_cond_timedwait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S:238
#1  0x00007f30c51f73e4 in wait (time=30000, this=0x20700f0) at thread/qwaitcondition_unix.cpp:84
#2  QWaitCondition::wait (this=<optimized out>, mutex=mutex@entry=0x2070308, time=30000) at thread/qwaitcondition_unix.cpp:158
#3  0x00007f30c51ea8a5 in QThreadPoolThread::run (this=0x27b62e0) at concurrent/qthreadpool.cpp:141
#4  0x00007f30c51f6f2f in QThreadPrivate::start (arg=0x27b62e0) at thread/qthread_unix.cpp:338
#5  0x00007f30c225af6e in start_thread (arg=0x7f309d4c5700) at pthread_create.c:311
#6  0x00007f30c49949cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:113

Thread 1 (Thread 0x7f30c7640800 (LWP 2215)):
[KCrash Handler]
#6  0x00007f30c7173d71 in KStatusNotifierItem::setStatus (this=this@entry=0x1f9c920, status=status@entry=KStatusNotifierItem::Active) at ../../kdeui/notifications/kstatusnotifieritem.cpp:156
#7  0x00007f30c63f7a75 in KMail::KMSystemTray::setMode (this=0x1f9c920, newMode=0) at ../../kmail/kmsystemtray.cpp:164
#8  0x00007f30c640373b in KMKernel::toggleSystemTray (this=0x7fffb022d490) at ../../kmail/kmkernel.cpp:2021
#9  0x00007f30c644027f in KMMainWidget::readConfig (this=this@entry=0x1fc9f30) at ../../kmail/kmmainwidget.cpp:855
#10 0x00007f30c6450088 in KMMainWidget::KMMainWidget (this=0x1fc9f30, parent=<optimized out>, aGUIClient=0x1a1c868, actionCollection=<optimized out>, config=...) at ../../kmail/kmmainwidget.cpp:268
#11 0x00007f30c63b7ace in KMMainWin::KMMainWin (this=0x1a1c800, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at ../../kmail/kmmainwin.cpp:69
#12 0x00007f30c640249f in KMKernel::openReader (this=0x7fffb022d490, onlyCheck=onlyCheck@entry=false) at ../../kmail/kmkernel.cpp:518
#13 0x00007f30c6406528 in KMKernel::action (this=this@entry=0x7fffb022d490, mailto=mailto@entry=false, check=check@entry=false, to=..., cc=..., bcc=..., subj=..., body=..., messageFile=..., attachURLs=..., customHeaders=..., replyTo=..., inReplyTo=...) at ../../kmail/kmkernel.cpp:1329
#14 0x00007f30c6407031 in KMKernel::handleCommandLine (this=0x7fffb022d490, noArgsOpensReader=noArgsOpensReader@entry=true) at ../../kmail/kmkernel.cpp:427
#15 0x0000000000403397 in KMailApplication::newInstance (this=0x7fffb022d460) at ../../kmail/main.cpp:87
#16 0x00007f30c7067ecc in KUniqueApplicationAdaptor::newInstance (this=0x18c9e80, asn_id=..., args=...) at ../../kdeui/kernel/kuniqueapplication.cpp:442
#17 0x00007f30c7067f55 in KUniqueApplicationAdaptor::qt_static_metacall (_o=_o@entry=0x18c9e80, _id=_id@entry=0, _a=_a@entry=0x7fffb022c790, _c=QMetaObject::InvokeMetaMethod) at ./kuniqueapplication_p.moc:58
#18 0x00007f30c7068173 in qt_static_metacall (_a=0x7fffb022c790, _id=0, _c=QMetaObject::InvokeMetaMethod, _o=0x18c9e80) at ./kuniqueapplication_p.moc:101
#19 KUniqueApplicationAdaptor::qt_metacall (this=0x18c9e80, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fffb022c790) at ./kuniqueapplication_p.moc:102
#20 0x00007f30c2de2e36 in QDBusConnectionPrivate::deliverCall (this=this@entry=0x16c5e20, object=object@entry=0x18c9e80, msg=..., metaTypes=..., slotIdx=4) at qdbusintegrator.cpp:951
#21 0x00007f30c2de3f8b in QDBusConnectionPrivate::activateCall (this=this@entry=0x16c5e20, object=0x18c9e80, flags=flags@entry=337, msg=...) at qdbusintegrator.cpp:863
#22 0x00007f30c2de499d in QDBusConnectionPrivate::activateObject (this=0x16c5e20, node=..., msg=..., pathStartPos=<optimized out>) at qdbusintegrator.cpp:1427
#23 0x00007f30c2de4a6b in QDBusActivateObjectEvent::placeMetaCall (this=0x2088ab0) at qdbusintegrator.cpp:1541
#24 0x00007f30c530edce in QObject::event (this=this@entry=0x7fffb022d460, e=e@entry=0x2088ab0) at kernel/qobject.cpp:1194
#25 0x00007f30c52fafdc in QCoreApplication::event (this=this@entry=0x7fffb022d460, e=e@entry=0x2088ab0) at kernel/qcoreapplication.cpp:1758
#26 0x00007f30c582bea3 in QApplication::event (this=0x7fffb022d460, e=0x2088ab0) at kernel/qapplication.cpp:2549
#27 0x00007f30c5826dfc in QApplicationPrivate::notify_helper (this=this@entry=0x16e1200, receiver=receiver@entry=0x7fffb022d460, e=e@entry=0x2088ab0) at kernel/qapplication.cpp:4567
#28 0x00007f30c582d470 in QApplication::notify (this=this@entry=0x7fffb022d460, receiver=receiver@entry=0x7fffb022d460, e=e@entry=0x2088ab0) at kernel/qapplication.cpp:4353
#29 0x00007f30c7060c6a in KApplication::notify (this=0x7fffb022d460, receiver=0x7fffb022d460, event=0x2088ab0) at ../../kdeui/kernel/kapplication.cpp:311
#30 0x00007f30c52f68bd in QCoreApplication::notifyInternal (this=0x7fffb022d460, receiver=receiver@entry=0x7fffb022d460, event=event@entry=0x2088ab0) at kernel/qcoreapplication.cpp:946
#31 0x00007f30c52f9e1f in sendEvent (event=0x2088ab0, receiver=0x7fffb022d460) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#32 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x1673220) at kernel/qcoreapplication.cpp:1570
#33 0x00007f30c52fa2c3 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1463
#34 0x00007f30c5324073 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#35 postEventSourceDispatch (s=0x16ce700) at kernel/qeventdispatcher_glib.cpp:279
#36 0x00007f30bc3783b6 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#37 0x00007f30bc378708 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#38 0x00007f30bc3787ac in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#39 0x00007f30c5323a55 in QEventDispatcherGlib::processEvents (this=0x1674b00, flags=...) at kernel/qeventdispatcher_glib.cpp:424
#40 0x00007f30c58c89d6 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#41 0x00007f30c52f55ef in QEventLoop::processEvents (this=this@entry=0x7fffb022d0b0, flags=...) at kernel/qeventloop.cpp:149
#42 0x00007f30c52f58e5 in QEventLoop::exec (this=this@entry=0x7fffb022d0b0, flags=...) at kernel/qeventloop.cpp:204
#43 0x00007f30c52fae5b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1218
#44 0x00007f30c582534c in QApplication::exec () at kernel/qapplication.cpp:3828
#45 0x0000000000402d1a in main (argc=<optimized out>, argv=<optimized out>) at ../../kmail/main.cpp:146

Possible duplicates by query: bug 328795, bug 328218, bug 327274, bug 324053, bug 323572.

Reported using DrKonqi
Comment 1 Saurav Sengupta 2013-12-21 07:33:42 UTC
After quitting KMail, an instance of the kmail process remains running in the background. Trying to start KMail again while this background kmail process is still running causes the crash. If the background process is first killed (e.g., killall kmail) and then KMail is started again, it starts normally. Again, after quitting the newly started instance, a kmail process remains running in the background, and so on. This happens every time.

Basically, after quitting KMail, no kmail process should remain running in the background.

A workaround is to change the kmail binary executable to use a script instead which starts the kmail binary, waits for it to end, then forcibly kills any remaining kmail processes.
Comment 2 Saurav Sengupta 2013-12-21 08:30:45 UTC
Well, it seems a workaround like this would not work or will be complicated because the kmail process remains running even after quitting KMail, so how do we know when KMail has been quit? It would be helpful if someone could provide some guidance on determining when KMail (the GUI) has been quit, if this is at all possible (especially given that the KMail window can also be hidden by clicking its system tray icon).
Comment 3 Jekyll Wu 2013-12-21 09:45:50 UTC

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