Bug 92416 - "Check new mail on IMAP" process never finishes
Summary: "Check new mail on IMAP" process never finishes
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: 2004-10-30 23:05 UTC by Gerard Beekmans
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
debugmailcheck.diff (3.12 KB, text/x-diff)
2004-11-01 12:24 UTC, Carsten Burghardt
Details
kmfolderimap.diff (609 bytes, text/x-diff)
2004-11-01 23:23 UTC, Carsten Burghardt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gerard Beekmans 2004-10-30 23:05:25 UTC
Version:            (using KDE KDE 3.3.1)
Installed from:    Compiled From Sources
Compiler:          GCC 3.4.1 
OS:                Linux

I just installed KDE-3.3.1 (from source) and am trying to get KMail to work. I am attempting to retrieve mail from an IMAP server and I'm having some problems with it.
 
It checks the mail just fine but it never finishes the process. It gets to 98% and just sits there. I can sometimes abort whatever it's doing and then check certain folders.
 
At first I thought there's either too much mail or it's just taking a long time processing it all. So I started to select some folders to subscribe to instead of checking all folders to see when the problems starts to happen. I kept adding folders to the subscription list and kept checking for new mail. It worked fine until I added some folder at which point it got to the 98% again and just sat there. The just added folder was empty. I removed this folder from the subscription list, restarted KMail assuming things would work again, but it didn't work then. It got to 98% again and then nothing. I removed more folders from the subscription list and at some point it started to work normally again. It doesn't seem to be tied to any particular folder it's checking mail in and hanging on.

I can provide a "strace" output if it would be helpful.
Comment 1 Carsten Burghardt 2004-10-31 15:41:40 UTC
Please compile kmail with --enable-debug=yes and send us the debug output that 
you get on the console when you check for new mail.

Comment 2 Gerard Beekmans 2004-10-31 19:11:40 UTC
Output is as follows:

kmail: processNextCheck, remaining 1
kmail: for host localhost current connections=0 and limit is 0
kmail: connection limit reached: false
kmail: processing next mail check for Garion
kmail: KMFolderImap::checkValidity of: /INBOX/
kmail: check mail started - connections for host localhost now is 1
kmail: KMFolderImap::slotCheckValidityResult of: INBOX
kmail: [void KIMProxy::unregisteredFromDCOP(const QCString&)] anonymous-21497

That is all that shows up. Kmail's progress bar when checking the mail got to 98% and nothing happens past that. It does indicate the proper amount of new email in all the folders, but I can't open any of them. When I try, the message "kmail: account Garion busy, queuing" sometimes appears, but not always.

I forgot to mention this in the original bug report: I'm using courier-imap version 3.0.7

Comment 3 Carsten Burghardt 2004-11-01 12:24:37 UTC
Please apply the attached patch (go to your kmail directory and do "patch -p0 
< debugmailcheck.diff"), recompile and get the debug output.
Thanks.

Carsten


Created an attachment (id=8122)
debugmailcheck.diff
Comment 4 Gerard Beekmans 2004-11-01 16:03:26 UTC
Patch applied, here's the output from the last few lines:

kmail: statresult 0
kmail: [void KMAcctImap::postProcessNewMail(KMFolder*)] Somefolder1 remain=3
kmail: statresult 0
kmail: [void KMAcctImap::postProcessNewMail(KMFolder*)] Somefolder2 remain=2
kmail: statresult 0
kmail: [void KMAcctImap::postProcessNewMail(KMFolder*)] Somefolder3 remain=1

(Somefolder* aren't the real names but I've changed the foldernames as they are names of people at work). And this is the point where kmail sits waiting for something at 98% progress.

Earlier on it did the "stat"s on the three aforementioned folders:

kmail: remain=161
kmail: stat /INBOX.Work.USG.Somefolder1/;SECTION=UNSEEN
kmail: folder returned true
kmail: remain=162
kmail: stat /INBOX.Work.USG.Somefolder2/;SECTION=UNSEEN
kmail: folder returned true
kmail: remain=163
kmail: stat /INBOX.Work.USG.Somefolder3/;SECTION=UNSEEN
kmail: folder returned true
kmail: check mail started - connections for host localhost now is 1

-----

After it gets stuck at 98% I can close Kmail and these last few lines of output show:

kmail: Closing last KMMainWin: stopping mail check
kmail: processNextCheck, remaining 0
kmail: account Garion finished check
kmail: connections to server localhost now 0
kmail: KMKernel::~KMKernel

-----
Comment 5 Carsten Burghardt 2004-11-01 17:34:10 UTC
On Monday 01 November 2004 16:03, Gerard Beekmans wrote:
> 16:03 ------- Patch applied, here's the output from the last few lines:
>
> kmail: statresult 0
> kmail: [void KMAcctImap::postProcessNewMail(KMFolder*)] Somefolder1

OK, I need the _complete_ debug output as you cut off the important part. If 
you don't want to attach it here you can send it to me in private mail 
(burghardt@kde.org)

Comment 6 Gerard Beekmans 2004-11-01 17:59:36 UTC
I'll email you the debug log unaltered (rather not put it here for privacy reasons).
Comment 7 Carsten Burghardt 2004-11-01 23:23:15 UTC
Please check if the attached patch fixes your problem. 


Created an attachment (id=8127)
kmfolderimap.diff
Comment 8 Gerard Beekmans 2004-11-01 23:59:48 UTC
Confirmed, that patch fixes the problem. After that last folder is checked I get the expected messages about the account being finished checking and a summary with which folders have new emails and how many.

I'll do some more testing to make sure it keeps on working as expected. If it doesn't cause more problems did you want me to mark the bug as resolved, or will one of kmail developers take care of that (I'm not sure what the policy is).
Comment 9 Carsten Burghardt 2004-11-03 23:02:09 UTC
CVS commit by burghard: 

Correctly end new-mail-check when a folder reports an error.
BUG: 92416


  M +1 -1      kmfolderimap.cpp   1.229.2.3


--- kdepim/kmail/kmfolderimap.cpp  #1.229.2.2:1.229.2.3
@@ -1730,6 +1730,6 @@ void KMFolderImap::slotStatResult(KIO::J
       }
     }
-    emit numUnreadMsgsChanged( folder() );
   }
+  emit numUnreadMsgsChanged( folder() );
 }