Bug 118112 - random crash during automatic polling
Summary: random crash during automatic polling
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: 1.8
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-11 13:56 UTC by Emil Obermayr
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 Emil Obermayr 2005-12-11 13:56:02 UTC
Version:           1.8 (using KDE KDE 3.4.0)
Installed from:    SuSE RPMs
OS:                Linux

every now and then kmail (started in kontact) just crashes; I think its during polling email by POP3 because there is always unpolled email on the server after the crash; so far I have now idea how to reproduce; after restart polling works fine

console output:

*** KMail got signal 11 (Crashing)
KCrash: Application 'kontact' crashing...

backtrace:

(no debugging symbols found)
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 1105573792 (LWP 18948)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[KCrash handler]
#7  0x41564e10 in QObject::receivers () from /usr/lib/qt3/lib/libqt-mt.so.3
#8  0x400fac07 in KPIM::ProgressItem::progressItemStatus ()
   from /opt/kde3/lib/libkdepim.so.1
#9  0x400facef in KPIM::ProgressItem::setStatus ()
   from /opt/kde3/lib/libkdepim.so.1
#10 0x42bdbc77 in KMAcctExpPop::slotJobFinished ()
   from /opt/kde3/lib/libkmailprivate.so
#11 0x42bdccd8 in KMAcctExpPop::slotResult ()
   from /opt/kde3/lib/libkmailprivate.so
#12 0x42bdcf14 in KMAcctExpPop::qt_invoke ()
   from /opt/kde3/lib/libkmailprivate.so
#13 0x41565e7e in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#14 0x40ac5432 in KIO::Job::result () from /opt/kde3/lib/libkio.so.4
#15 0x40b23a3c in KIO::Job::emitResult () from /opt/kde3/lib/libkio.so.4
#16 0x40b2b08c in KIO::SimpleJob::slotFinished ()
   from /opt/kde3/lib/libkio.so.4
#17 0x40b2b83a in KIO::TransferJob::slotFinished ()
   from /opt/kde3/lib/libkio.so.4
#18 0x40b18867 in KIO::TransferJob::qt_invoke () from /opt/kde3/lib/libkio.so.4
#19 0x41565e7e in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#20 0x41566626 in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#21 0x40acac6c in KIO::SlaveInterface::finished ()
   from /opt/kde3/lib/libkio.so.4
#22 0x40afe818 in KIO::SlaveInterface::dispatch ()
   from /opt/kde3/lib/libkio.so.4
#23 0x40ad9753 in KIO::SlaveInterface::dispatch ()
   from /opt/kde3/lib/libkio.so.4
#24 0x40ada94b in KIO::Slave::gotInput () from /opt/kde3/lib/libkio.so.4
#25 0x40b01c3a in KIO::Slave::qt_invoke () from /opt/kde3/lib/libkio.so.4
#26 0x41565e7e in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#27 0x415664ad in QObject::activate_signal ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#28 0x418ba1f0 in QSocketNotifier::activated ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#29 0x41585a70 in QSocketNotifier::event () from /usr/lib/qt3/lib/libqt-mt.so.3
#30 0x41502d5f in QApplication::internalNotify ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#31 0x41504a83 in QApplication::notify () from /usr/lib/qt3/lib/libqt-mt.so.3
#32 0x4118d6b1 in KApplication::notify () from /opt/kde3/lib/libkdecore.so.4
#33 0x414f6e76 in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#34 0x414b0242 in QEventLoop::processEvents ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#35 0x4151ae51 in QEventLoop::enterLoop () from /usr/lib/qt3/lib/libqt-mt.so.3
#36 0x4151ac96 in QEventLoop::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#37 0x4150494f in QApplication::exec () from /usr/lib/qt3/lib/libqt-mt.so.3
#38 0x08063d75 in ?? ()
#39 0xbfffed90 in ?? ()
#40 0x00000001 in ?? ()
#41 0x00000001 in ?? ()
#42 0x00000000 in ?? ()
#43 0x00000000 in ?? ()
#44 0x00000001 in ?? ()
#45 0x08069124 in typeinfo name for QPtrList<KParts::Part> ()
#46 0x00000000 in ?? ()
#47 0x080682ca in typeinfo name for QPtrList<KParts::Part> ()
#48 0x08068749 in typeinfo name for QPtrList<KParts::Part> ()
#49 0x08c777ef in ?? ()
#50 0x413e60ba in ?? () from /usr/lib/qt3/lib/libqt-mt.so.3
#51 0x4000dbce in _dl_name_match_p () from /lib/ld-linux.so.2
#52 0x41d53e80 in __libc_start_main () from /lib/tls/libc.so.6
#53 0x08058ab1 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)