Closed Bug 289674 Opened 19 years ago Closed 8 years ago

inbox unread count is wrong. The number Increase although there is no new mail.

Categories

(Thunderbird :: Mail Window Front End, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: martsummsw, Unassigned)

References

(Blocks 1 open bug)

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050330 Firefox/1.0.2
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050330 Firefox/1.0.2


I have searched for people with same problem, but I am unsure if they had
exactly the same problem. It could look like it increases on every mailcheck. I
tried setting mailcheck from 2 to 6 minuttes and it seems to slow down the count. 

The unread messages always continue to increase with the same value (when no new
mails arrives and it is not disturbed manually). It seems like this is often the
number of unread messages at startup.

I access 2 SSL pop-servers. I have Automaticcally download new messages checked. 
At first I guessed that this probably was a clockproblem, but I guess it is not.

A doubleclick on the inbox item starts up a new Thunderbird and in 99-100% of
the cases both windwos now show the correct inbox count. But this only stops it
for a short period of time then it is increasing again. 


Reproducible: Always

Steps to Reproduce:
1. Make sure you have unread mails
2. Open Thunderbird
3. Wait
However I have seen machines without this problem.
Actual Results:  
Unread count keeps increasing for some strange reason.

Expected Results:  
Unread count should match the number of unread mails.


Hope you will fix this or give me a link to a reason+solution. I have searched
the web and your forum without luck.

Regards & thanks for a nice free program.
I may be experiencing the same thing. My main inbox for one of my accounts on
each  occasion of opening TB 1.0.3 (and the latest nightly 20050413) increases
the total of unread messages by 10. Although it is no longer mentioned in the
status bar, I believe the Inbox index is being rebuilt each time. As it take a
few moments before being able to view messages. 

I believe it may be a profile issue as other accounts (one POP and one IMAP) do
not have the same problem.
I can confirm this in TB 1.0.6 (20050716) on Windows. I experience the same
exact problems as comment #1 above (inbox appears to be rebuilt as it takes a
long time to load, reports high number of mail (both read and unread) when in
actuality I have no unread and between 30 and 40 read. Not sure what the problem
is, but this only effects my main account, as I have two others in TB that don't
display this problem.
Status: UNCONFIRMED → NEW
Ever confirmed: true
This problem is getting increasingly worse with each passing day. I'd hate to
have to delete my profile and start all over...
Yes, I have had the same experience as reported by the others. Everything
freezes when this erratic inflation of the numbers of mails starts. The Inbox
does not open for a long time and when it does it is sluggish. I have not been
able to find a co-relation between this inflation and anything else that I may
be doing at the time.

Should one reload Thunderbird? I've been happy with Thunderird and Firefox 
since Jan this year, and virus attacks via Microsoft products are now a distant
memory. This revives old anxieties so help!

Chandita Mukherjee
*** Bug 315558 has been marked as a duplicate of this bug. ***
Can this be reproduced in either 1.5 or a nightly?
What type of accounts? POP3 or IMAP?
Component: General → Mail Window Front End
OS: Linux → All
For me, it's POP3 accounts. Haven't tried 1.5 yet, still running 1.0.7. 
Then again, I don't have an IMAP accounts set up through Thunderbird.
See also bug 320895.
*** Bug 320895 has been marked as a duplicate of this bug. ***
imported e-mails to inbox cannot be deleted any which way and always come back and inbox increases to thousands in size and therefore thunderbird is very slow due to all unwanted e-mails that cannot be deleted.
Please find solution to rid my inbox of these unwanted e-mails.
Thanks
Not sure if this is relevant. I've totalled up all the sizes of mails in my inbox and it comes to 56233kb. Running Diskeeper (Professional version) tells me that my Inbox is the most fragmented file on my hard disk - with a size of 929Mb! That's some fragmentation!!!
QA Contact: front-end
This bug still occurs in T 2.0 ; a solution is to delete the ".msf" file in the profile directory corresponding with the inbox account and the directory.
Additionally, it seems to be triggered by the reception of some particular emails ...
(In reply to comment #14)
> This bug still occurs in T 2.0 ; a solution is to delete the ".msf" file
> Additionally, it seems to be triggered by the reception of some particular emails ...

"Rebuild index" of Tb 2.0 including 2.0.0.4 has Bug 363008(fixed on trunk only), and if "rebuild index" internally occurs, double count will certainly appear.

To Etienne Membrives:  
It sounds that phenomenon of Bug 363008 is involved in your case. Can next MozillaZine Knowledge Base article, "Keep it working - Thunderbird", help you? Will frequency of problem be reduced by some actions in it? 
  http://kb.mozillazine.org/Keep_it_working_%28Thunderbird%29

(In reply to comment #12)
> I've totalled up all the sizes of mails in my inbox and it comes to 56233kb.
> with a size of 929Mb!
To Martin Dennett:
Please read next MozillaZine Knowledge Base article, "Compacting Folders", in addition to above article.
  http://kb.mozillazine.org/Compacting_folders
WADA

Thanks for that. It has now managed to sort itself out - not sure if it occurred when an update to Thunderbird itself came out or not, but the problem has now gone away!
Blocks: 438257
Assignee: mscott → nobody
Hi,

I thing that problem is in nsMsgLocalMailFolder::CopyFileMessage(nsIFileSpec* fileSpec, nsIMsgDBHdr*
                                      msgToReplace, PRBool isDraftOrTemplate,
                                      PRUint32 newMsgFlags,
                                      nsIMsgWindow *msgWindow,
                                      nsIMsgCopyServiceListener* listener)


A parameter newMsgFlags isn’t used (referenced) in implementation. In my case I assumed that this newMsgFlags flags are set but they aren’t. I traced it into nsMsgDatabase::AddNewHdrToDB where is checked whether is message read or not.
A result was that message isn't read and then is increased number of unread 
messages 

NS_IMETHODIMP nsMsgDatabase::AddNewHdrToDB(nsIMsgDBHdr *newHdr, PRBool notify)
{
  nsMsgHdr* hdr = NS_STATIC_CAST(nsMsgHdr*, newHdr);          // closed system, cast ok
  PRBool newThread;
  
  nsresult err = ThreadNewHdr(hdr, newThread);
  // we thread header before we add it to the all headers table
  // so that subject threading will work (otherwise, when we try
  // to find the first header with the same subject, we get the
  // new header!
  if (NS_SUCCEEDED(err))
  {
    nsMsgKey key;
    PRUint32 flags;
    
    newHdr->GetMessageKey(&key);
    hdr->GetRawFlags(&flags);
    // use raw flags instead of GetFlags, because GetFlags will
    // pay attention to what's in m_newSet, and this new hdr isn't
    // in m_newSet yet.
    if (flags & MSG_FLAG_NEW)
    {
      PRUint32 newFlags;
      newHdr->AndFlags(~MSG_FLAG_NEW, &newFlags);	// make sure not 
      AddToNewList(key);
    }
    if (m_dbFolderInfo != NULL)
    {
      m_dbFolderInfo->ChangeNumMessages(1);
      PRBool isRead = PR_TRUE;
      IsHeaderRead(newHdr, &isRead);    // here i got isRead == PR_FALSE
      if (!isRead) 
        m_dbFolderInfo->ChangeNumUnreadMessages(1);


Here is part of my callstack:

mail.dll!nsMsgDatabase::AddNewHdrToDB(nsIMsgDBHdr * newHdr=0x043eff90, int notify=1)  Line 3088	C++
 mail.dll!nsMsgLocalMailFolder::EndCopy(int copySucceeded=1)  Line 2705	C++
 mail.dll!nsMsgLocalMailFolder::CopyFileMessage(nsIFileSpec * fileSpec=0x04fc2440, nsIMsgDBHdr * msgToReplace=0x00000000, int isDraftOrTemplate=0, unsigned int newMsgFlags=1, nsIMsgWindow * msgWindow=0x040fb4e8, nsIMsgCopyServiceListener * listener=0x013727a8)  Line 2244 + 0x1a bytes	C++
 mail.dll!nsMsgCopyService::DoNextCopy()  Line 368 + 0x57 bytes	C++
 mail.dll!nsMsgCopyService::DoCopy(nsCopyRequest * aRequest=0x0450abf8)  Line 272 + 0x8 bytes	C++
 mail.dll!nsMsgCopyService::CopyFileMessage(nsIFileSpec * fileSpec=0x04fc2440, nsIMsgFolder * dstFolder=0x041a3050, nsIMsgDBHdr * msgToReplace=0x00000000, int isDraft=0, unsigned int aMsgFlags=1, nsIMsgCopyServiceListener * listener=0x013727a8, nsIMsgWindow * window=0x040fb4e8)  Line 634 + 0xc bytes	C++


I hope this will be helpful.
Is this still happening in current versions?
Yes, still happening with 12.0.1
I'm seeing this from time to time, but haven't figured out, when this number is shown or when not. 

TB 12.0.1 on Windows 7 x64.
At least one person has reported this problem is gone. If anyone disagrees, please add a comment to the bug.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → WORKSFORME
This started happening a few days ago. I am running 31.6.0 on Mac OS X 10.10.3.

Currently my POP3 inbox is showing 67 unread messages. There are no actual unread messages, and only about thirty messages in total in the Inbox.

When two new messages came in, the count went up to 69. After I had opened these two messages the count went back to 67.

In my deleted folder in Local Folders the unread message count was 38; that could be right as some messages get deleted without reading.

But then I emptied my Deleted Folder. It is empty. But the unread message count remains at 38.

Closing down and restarting - compacting - do not affect this state. It is a nuisance but not game changing - yet.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
I've discovered the cause.

Tbird had created a new Junk folder as a subfolder of Inbox and is moving anything it identifies as Junk directly to that folder, unread of course. So of course the number of unread messages is increasing.

I just did not notice that Inbox now has a Junk subfolder. The old Junk folder is still there as a main folder alongside Inbox folder.
comment 24 is not a bug. so closing WFM per comment 22
Status: REOPENED → RESOLVED
Closed: 9 years ago8 years ago
Resolution: --- → WORKSFORME
I've been getting this bug for a decade, using POP and multiple accounts.

On startup, I see many sub-folders indicating that they have unread messages.
When I click on a folder, it no longer shows any unread messages.

My conclusion is that there is a problem when checking unread messages at startup.

Compacting folders doesn't fix this, and neither does deleting the .msf file.

The smallest number of emails in a folder that shows this problem is 121, and the largest was 45,045.

I'm currently running version 52.7.0 (32-bit), on Windows 7 Ultimate 64-bit.
You need to log in before you can comment on or make changes to this bug.