Bug 110487 - KMail crashes with SIGSEGV after running a few days.
Summary: KMail crashes with SIGSEGV after running a few days.
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.8.1
Platform: unspecified Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-09 21:37 UTC by Sam Grinstead
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Grinstead 2005-08-09 21:37:39 UTC
Version:           1.8.1 (using KDE KDE 3.4.1)
Installed from:    Unlisted Binary Package
Compiler:           compiled by the kde-redhat project http://kde-redhat.sourceforge.net/
OS:                Linux

The system is Fedora Core 3 using the kde-redhat rpms (v 3.4.1-1.3.fc3.kde, if that helps).   

When KMail has been running in the background (just a tray icon) for a few days, it will crash and throw up the crash window.   I didn't save the backtraces the first couple times, but they have all been SIGSEGV, if memory serves me correctly.

Recovery seems fine when starting it back after this crash.   I can throw in a second trace to make sure the same thing is happening in a couple days.

The most recent backtrace is here:
_______________________________________________________________________

Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1208662336 (LWP 7392)]
[KCrash handler]
#4  0x02aa5537 in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#5  0x034aba40 in KPIM::ProgressItem::progressItemStatus ()
   from /usr/lib/libkdepim.so.1
#6  0x034aba99 in KPIM::ProgressItem::setStatus ()
   from /usr/lib/libkdepim.so.1
#7  0x034be88f in KPIM::BroadcastStatus::setStatusMsgTransmissionCompleted ()
   from /usr/lib/libkdepim.so.1
#8  0x03948818 in KMAcctExpPop::slotJobFinished ()
   from /usr/lib/libkmailprivate.so
#9  0x03948cfc in KMAcctExpPop::slotResult () from /usr/lib/libkmailprivate.so
#10 0x03949388 in KMAcctExpPop::qt_invoke () from /usr/lib/libkmailprivate.so
#11 0x02aa562e in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#12 0x03f9e329 in KIO::Job::result () from /usr/lib/libkio.so.4
#13 0x03fc8778 in KIO::Job::emitResult () from /usr/lib/libkio.so.4
#14 0x03ff7b2e in KIO::SimpleJob::slotFinished () from /usr/lib/libkio.so.4
#15 0x03ff8298 in KIO::TransferJob::slotFinished () from /usr/lib/libkio.so.4
#16 0x03fc83a2 in KIO::TransferJob::qt_invoke () from /usr/lib/libkio.so.4
#17 0x02aa562e in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#18 0x02aa5d04 in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#19 0x03f9c730 in KIO::SlaveInterface::finished () from /usr/lib/libkio.so.4
#20 0x03fe8b12 in KIO::SlaveInterface::dispatch () from /usr/lib/libkio.so.4
#21 0x03fc6433 in KIO::SlaveInterface::dispatch () from /usr/lib/libkio.so.4
#22 0x03fbd42c in KIO::Slave::gotInput () from /usr/lib/libkio.so.4
#23 0x03fc4bcf in KIO::Slave::qt_invoke () from /usr/lib/libkio.so.4
#24 0x02aa562e in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#25 0x02aa5bc0 in QObject::activate_signal ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#26 0x02dd9450 in QSocketNotifier::activated ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#27 0x02ac0755 in QSocketNotifier::event ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#28 0x02a46a19 in QApplication::internalNotify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#29 0x02a46baa in QApplication::notify ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#30 0x030fbaa6 in KApplication::notify () from /usr/lib/libkdecore.so.4
#31 0x02a3aed2 in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#32 0x029f525e in QEventLoop::processEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#33 0x02a5c0b5 in QEventLoop::enterLoop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#34 0x02a5c00e in QEventLoop::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#35 0x02a45c1b in QApplication::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#36 0x0804a304 in ?? ()
#37 0xbff08540 in ?? ()
#38 0xbff08450 in ?? ()
#39 0x00000000 in ?? ()
_______________________________________________________________________
Comment 1 Ingo Klöcker 2006-07-05 22:06:55 UTC
SVN commit 558673 by kloecker:

Fix progress item related crashes during POP3 fetches.

BUGS: 110487, 118112, 119112, 121384, 127210, 130303


 M  +4 -1      kmaccount.cpp  
 M  +30 -20    popaccount.cpp  


--- branches/KDE/3.5/kdepim/kmail/kmaccount.cpp #558672:558673
@@ -444,8 +444,11 @@
   if (mTimer)
     mTimer->start(mInterval*60000);
   if ( mMailCheckProgressItem ) {
-    mMailCheckProgressItem->setComplete(); // that will delete it
+    // set mMailCheckProgressItem = 0 before calling setComplete() to prevent
+    // a race condition
+    ProgressItem *savedMailCheckProgressItem = mMailCheckProgressItem;
     mMailCheckProgressItem = 0;
+    savedMailCheckProgressItem->setComplete(); // that will delete it
   }
 
   emit newMailsProcessed( mNewInFolder );
--- branches/KDE/3.5/kdepim/kmail/popaccount.cpp #558672:558673
@@ -348,8 +348,9 @@
 void PopAccount::slotAbortRequested()
 {
   if (stage == Idle) return;
-  disconnect( mMailCheckProgressItem, SIGNAL( progressItemCanceled( KPIM::ProgressItem* ) ),
-           this, SLOT( slotAbortRequested() ) );
+  if ( mMailCheckProgressItem )
+    disconnect( mMailCheckProgressItem, SIGNAL( progressItemCanceled( KPIM::ProgressItem* ) ),
+                this, SLOT( slotAbortRequested() ) );
   stage = Quit;
   if (job) job->kill();
   job = 0;
@@ -655,7 +656,8 @@
     processMsgsTimer.start(processingDelay);
   }
   else if (stage == Retr) {
-    mMailCheckProgressItem->setProgress( 100 );
+    if ( mMailCheckProgressItem )
+      mMailCheckProgressItem->setProgress( 100 );
     processRemainingQueuedMessages();
 
     mHeaderDeleteUids.clear();
@@ -732,20 +734,22 @@
     // If there are messages to delete then delete them
     if ( !idsOfMsgsToDelete.isEmpty() ) {
       stage = Dele;
-      mMailCheckProgressItem->setStatus(
-        i18n( "Fetched 1 message from %1. Deleting messages from server...",
-              "Fetched %n messages from %1. Deleting messages from server...",
-              numMsgs )
-        .arg( mHost ) );
+      if ( mMailCheckProgressItem )
+        mMailCheckProgressItem->setStatus(
+          i18n( "Fetched 1 message from %1. Deleting messages from server...",
+                "Fetched %n messages from %1. Deleting messages from server...",
+                numMsgs )
+          .arg( mHost ) );
       url.setPath("/remove/" + idsOfMsgsToDelete.join(","));
       kdDebug(5006) << "url: " << url.prettyURL() << endl;
     } else {
       stage = Quit;
-      mMailCheckProgressItem->setStatus(
-        i18n( "Fetched 1 message from %1. Terminating transmission...",
-              "Fetched %n messages from %1. Terminating transmission...",
-              numMsgs )
-        .arg( mHost ) );
+      if ( mMailCheckProgressItem )
+        mMailCheckProgressItem->setStatus(
+          i18n( "Fetched 1 message from %1. Terminating transmission...",
+                "Fetched %n messages from %1. Terminating transmission...",
+                numMsgs )
+          .arg( mHost ) );
       url.setPath(QString("/commit"));
       kdDebug(5006) << "url: " << url.prettyURL() << endl;
     }
@@ -760,11 +764,12 @@
       mUidsOfNextSeenMsgsDict.remove( mUidForIdMap[*it] );
     }
     idsOfMsgsToDelete.clear();
-    mMailCheckProgressItem->setStatus(
-      i18n( "Fetched 1 message from %1. Terminating transmission...",
-            "Fetched %n messages from %1. Terminating transmission...",
-            numMsgs )
-      .arg( mHost ) );
+    if ( mMailCheckProgressItem )
+      mMailCheckProgressItem->setStatus(
+        i18n( "Fetched 1 message from %1. Terminating transmission...",
+              "Fetched %n messages from %1. Terminating transmission...",
+              numMsgs )
+        .arg( mHost ) );
     KURL url = getUrl();
     url.setPath(QString("/commit"));
     job = KIO::get( url, false, false );
@@ -783,8 +788,11 @@
       int numMessages = canceled ? indexOfCurrentMsg : idsOfMsgs.count();
       BroadcastStatus::instance()->setStatusMsgTransmissionCompleted(
         this->name(), numMessages, numBytes, numBytesRead, numBytesToRead, mLeaveOnServer, mMailCheckProgressItem );
-      mMailCheckProgressItem->setComplete();
+      // set mMailCheckProgressItem = 0 before calling setComplete() to prevent
+      // a race condition
+      ProgressItem *savedMailCheckProgressItem = mMailCheckProgressItem;
       mMailCheckProgressItem = 0;
+      savedMailCheckProgressItem->setComplete(); // that will delete it
       checkDone( ( numMessages > 0 ), canceled ? CheckAborted : CheckOK );
     }
   }
@@ -873,7 +881,9 @@
       numMsgBytesRead = curMsgLen;
     numBytesRead += numMsgBytesRead - oldNumMsgBytesRead;
     dataCounter++;
-    if (dataCounter % 5 == 0)
+    if ( mMailCheckProgressItem &&
+         ( dataCounter % 5 == 0 ||
+           ( indexOfCurrentMsg + 1 == numMsgs && numMsgBytesRead == curMsgLen ) ) )
     {
       QString msg;
       if (numBytes != numBytesToRead && mLeaveOnServer)