Bug 130938 - kmail stops checking local mailbox
Summary: kmail stops checking local mailbox
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-16 22:40 UTC by Simon Munton
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch to remove mProcessingNewMail (1.28 KB, patch)
2006-07-16 22:43 UTC, Simon Munton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Munton 2006-07-16 22:40:42 UTC
Version:            (using KDE KDE 3.5.3)
Installed from:    Compiled From Sources
Compiler:          gcc 3.4.6 
OS:                Linux

When kmail is getting mail from a local mailbox, and either the check mail button is pressed or the mail check interval starts a new mail check, then subsequently no more mail is downloaded from the local mailbox.

The problem is caused by both accountmanager.cpp and kmacctlocal.cpp checking if a mail check is in progress and it gets into the state where accountmanager thinks there is a mail check in progress, but kmacctlocal thinks there is not.

The following backtrace shows the point where it goes wrong. 
In frame 8, processNextCheck calls setCheckingMail(true) for the account. 
In frame 7, processNewMail sets mProcessingNewMail to true.

During the mail fetch, interval checking kicks in, but singleCheckMail finds a mail check in progress, so queues the mail check and returns.

In frame 5, checkDone is called after the mail has been fetched. checkDone calls setCheckingMail(false) (but mProcessingNewMail is still true). While still in checkDone, processNextCheck is called for the earlier queued check.
In frame 1, processNextCheck calls setCheckingMail(true), and then calls processNewMail.
In frame 0, processNewMail finds that mProcessingNewMail is still true and returns immediately. As checkDone is not called in this instance, setCheckingMail(false) is not called.
Eventually control returns to processNewMail in frame 7, which then sets mProcessingNewMail to false.

At this point accountmanager still thinks a mail check is in progress, so no more mail is ever fetched.

#0  KMAcctLocal::processNewMail (this=0x823b778) at kmacctlocal.cpp:80
#1  0xb7d1de05 in KMail::AccountManager::processNextCheck (this=0x8225050, _newMail=true) at accountmanager.cpp:196
#2  0xb7d1edeb in KMail::AccountManager::qt_invoke (this=0x8225050, _id=7, _o=0xbfe526f0) at accountmanager.moc:185
#3  0xb6071b2c in QObject::activate_signal () from /usr/lib/qt/lib/libqt-mt.so.3
#4  0xb7ca7766 in KMAccount::finishedCheck (this=0x823b778, t0=true, t1=KMAccount::CheckOK) at kmaccount.moc:218
#5  0xb7ca8f6f in KMAccount::checkDone (this=0x823b778, newmail=true, status=11270) at kmaccount.cpp:452
#6  0xb7d26785 in KMAcctLocal::postProcess (this=0x823b778) at kmacctlocal.cpp:282
#7  0xb7d26bf8 in KMAcctLocal::processNewMail (this=0x823b778) at kmacctlocal.cpp:109
#8  0xb7d1de05 in KMail::AccountManager::processNextCheck (this=0x8225050, _newMail=false) at accountmanager.cpp:196
#9  0xb7d1df7f in KMail::AccountManager::singleCheckMail (this=0x8225050, account=0x823b778, interactive=true) at accountmanager.cpp:125
#10 0xb7d1e122 in KMail::AccountManager::checkMail (this=0x8225050, _interactive=true) at accountmanager.cpp:312
#11 0xb7e3e9b4 in KMMainWidget::slotCheckMail (this=0x826b390) at kmmainwidget.cpp:801


Two possible fixes for this problem.
1. call checkDone if returning from processNewMail due to mProcessingNewMail being true
2. Remove all mProcessingNewMail stuff from kmacctlocal.cpp and rely on accountmanager to serialise mail checking
Comment 1 Simon Munton 2006-07-16 22:43:17 UTC
Created attachment 17012 [details]
patch to remove mProcessingNewMail

This patch removes the mProcessingNewMail stuff from kmacctlocal.cpp and
kmacctlocal.h
Comment 2 Allen Winter 2006-09-20 23:30:23 UTC
SVN commit 586892 by winterz:

Fix for "kmail stops checking local mailbox"

Patch provided by Simon (Thanks!) and approved by Ingo and Till.

BUGS: 130938


 M  +1 -7      kmacctlocal.cpp  
 M  +0 -1      kmacctlocal.h  


--- branches/KDE/3.5/kdepim/kmail/kmacctlocal.cpp #586891:586892
@@ -31,7 +31,7 @@
 //-----------------------------------------------------------------------------
 KMAcctLocal::KMAcctLocal(AccountManager* aOwner, const QString& aAccountName, uint id):
   KMAccount(aOwner, aAccountName, id), mHasNewMail( false ),
-  mProcessingNewMail( false ), mAddedOk( true ), mNumMsgs( 0 ),
+  mAddedOk( true ), mNumMsgs( 0 ),
   mMsgsFetched( 0 ), mMailFolder( 0 )
 {
   mLock = procmail_lockfile;
@@ -73,14 +73,9 @@
 //-----------------------------------------------------------------------------
 void KMAcctLocal::processNewMail(bool)
 {
-  if ( mProcessingNewMail )
-    return;
-
   mHasNewMail = false;
-  mProcessingNewMail = true;
 
   if ( !preProcess() ) {
-    mProcessingNewMail = false;
     return;
   }
 
@@ -99,7 +94,6 @@
   }
 
   postProcess();
-  mProcessingNewMail = false;
 }
 
 
--- branches/KDE/3.5/kdepim/kmail/kmacctlocal.h #586891:586892
@@ -46,7 +46,6 @@
   QString mLocation;
   QString mProcmailLockFileName;
   bool mHasNewMail;
-  bool mProcessingNewMail;
   bool mAddedOk;
   LockType mLock;
   int mNumMsgs;