Version: 1.7 (using KDE 3.3.0, Gentoo) Compiler: gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6) OS: Linux (i686) release 2.6.7 Kmail often crashes when I expire mails via menu. It seems I have to type some more words here just to make bugzilla happy. There not much more to write: I select expire, kmail crashes.
What type of account is this? Is it reproducable? Please compile kmail with --enable-debug=full and post the backtrace.
This is a local (mbox) account. Yes, it is reproducible, but not allways. Will start recompiling kdepim today... Stay tuned.
Quick update: Recompiled with debugging symbols, and had the crash (segfault, btw.) a couple fo minutes ago, but wasn't aware I need gdb installed to get a backtrace. Let's see when it will happen again. One clarification: While the account is an mbox one (mails are taken from ~/mbox), everything else is maildir.
Given that Expire is available in the RMB popupmenu for a folder, can you try to find out which folder crashes when being expired? Then the question will be whether that folder is mbox or maildir, and whether I can have a copy of it :) Or a backtrace, of course.
Created attachment 7478 [details] Backtrace of the crash
Expiring folder by folder did not result in the crash. And the expired folders are all maildir. I have attached a trace now, but I'm afraid that Gentoo stripped the symbols regardless of the "debug" USE flag. If this is not sufficient I'll try to rebuild again and prohibit stripping.
On Friday 10 September 2004 09:54, Dirk Heinrichs wrote: > Expiring folder by folder did not result in the crash. And the expired folders are all maildir. > I have attached a trace now, but I'm afraid that Gentoo stripped the symbols regardless of the "debug" USE flag. > If this is not sufficient I'll try to rebuild again and prohibit stripping. Any debug output from just before the crash? This is KDE-3.3.0-final, right? (kmfolder.cpp r1.338 if you have the release tarball) If you can recompile to get debug symbols (-g3) in kmail, can you also uncomment #define DEBUG_SCHEDULER at the top of jobscheduler.h? This will make the debug output more complete, for the job scheduling stuff (which is where the crash happens).
Created attachment 7519 [details] New backtrace, now with debug information OK, I recompiled now, preventing Gentoo portage from stripping the symbols. I also modified jobscheduler.h. The first thing that changed is that the crash is now 100% reproducible (if "Expire old Mails from all folders" is selected from the main menu). The other thing is that the backtrace got even shorter, didn't expect that.
Created attachment 7520 [details] Another backtrace, from expiring a single folder I now also managed to get the crash by expiring a single folder (had to try several times, though).
> OK, I recompiled now, preventing Gentoo portage from stripping the symbols. I > also modified jobscheduler.h. Thanks for the backtraces. Since you enabled the debug output in jobscheduler.h, can you send me that debug output? Either run kmail from a terminal with kmail 2>&1 | tee log and send me the log file, or check ~/.xsession-errors for the logs of a kmail started by KDE (the first way is simpler in your case, since the bug is reproduceable)
Created attachment 7523 [details] Log containing job scheduler output Here it comes.
Yay, I found where the bug is. In this particular situation a task gets run and deleted but not removed from list. Attached patch should fix the crash. Created an attachment (id=7525) jobscheduler.diff
CVS commit by faure: Fix crash when expiring mail with the menu item CCMAIL: 88508-done@bugs.kde.org M +12 -8 jobscheduler.cpp 1.7.2.1 M +2 -1 jobscheduler.h 1.6.2.1 --- kdepim/kmail/jobscheduler.cpp #1.7:1.7.2.1 @@ -62,5 +62,5 @@ void JobScheduler::registerTask( Schedul KMFolder* folder = task->folder(); // Search for an identical task already scheduled - for( QValueList<ScheduledTask *>::ConstIterator it = mTaskList.begin(); it != mTaskList.end(); ++it ) { + for( QValueList<ScheduledTask *>::Iterator it = mTaskList.begin(); it != mTaskList.end(); ++it ) { if ( (*it)->taskTypeId() == typeId && (*it)->folder() == folder ) { #ifdef DEBUG_SCHEDULER @@ -70,4 +70,5 @@ void JobScheduler::registerTask( Schedul if ( !mCurrentTask && immediate ) { ScheduledTask* task = *it; + removeTask( it ); runTaskNow( task ); } @@ -92,4 +93,11 @@ void JobScheduler::registerTask( Schedul } +void JobScheduler::removeTask( TaskList::Iterator& it ) +{ + if ( (*it)->isImmediate() ) + --mPendingImmediateTasks; + mTaskList.remove( it ); +} + void JobScheduler::notifyOpeningFolder( KMFolder* folder ) { @@ -130,5 +138,5 @@ void JobScheduler::slotRunNextJob() ScheduledTask* task = 0; // Find a task suitable for being run - for( QValueList<ScheduledTask *>::Iterator it = mTaskList.begin(); it != mTaskList.end(); ++it ) { + for( TaskList::Iterator it = mTaskList.begin(); it != mTaskList.end(); ++it ) { // Remove if folder died KMFolder* folder = (*it)->folder(); @@ -137,7 +145,5 @@ void JobScheduler::slotRunNextJob() kdDebug(5006) << " folder for task " << (*it) << " was deleted" << endl; #endif - if ( (*it)->isImmediate() ) - --mPendingImmediateTasks; - mTaskList.remove( it ); + removeTask( it ); if ( !mTaskList.isEmpty() ) slotRunNextJob(); // to avoid the mess with invalid iterators :) @@ -156,7 +162,5 @@ void JobScheduler::slotRunNextJob() if ( !folder->isOpened() ) { task = *it; - mTaskList.remove( it ); - if ( task->isImmediate() ) - --mPendingImmediateTasks; + removeTask( it ); break; } --- kdepim/kmail/jobscheduler.h #1.6:1.6.2.1 @@ -120,6 +120,7 @@ private: void interruptCurrentTask(); void runTaskNow( ScheduledTask* task ); -private: typedef QValueList<ScheduledTask *> TaskList; + void removeTask( TaskList::Iterator& it ); +private: TaskList mTaskList; // FIFO of tasks to be run