Closed Bug 482754 Opened 15 years ago Closed 15 years ago

Folders indicate new messages when no new messages present; message count incorrect as well

Categories

(Thunderbird :: Folder and Message Lists, defect)

defect
Not set
minor

Tracking

(Not tracked)

VERIFIED FIXED
Thunderbird 3.0b3

People

(Reporter: nixon049, Assigned: Bienvenu)

References

Details

(Keywords: regression)

Attachments

(3 files, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b2) Gecko/20081201 Firefox/3.1b2
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b4pre) Gecko/20090311 Shredder/3.0b3pre ID:20090311025302

Recent nightly builds are showing "new" messages and triggering the new message alert sound for folders that do not contain any new messages. Folders are highlighted in blue, as if new messages are present. Checking folder shows nothing new. When Extra Folder Columns add-on is installed, some of the affected folders are reporting negative message counts. I have three folders right now showing negative counts - two with -13, one with -271. Clicking the folders restores the actual new and total message counts.

Disabling Extra Folder Columns doesn't fix the erroneous new message indicator.

Reproducible: Always
Did you already try to rebuild the index of that folders ?
I also just started experiencing this after 2-3 nightly builds ago. I have many (30+) folder being accessed via IMAP (from Exchange 2007 server) and most of them will highlight as containing new messages every time a scheduled or manual check for new messages occurs. The new message count badge on the Dock Icon also blows up sometimes to 750+ (when there are zero or few real new messages).

I have not tried to re-build the index since it would be for each folder, some of which are quite large, and would take a long time... is this a necessary step or a shot in the dark? Any way to tell before I have to re-index all folders (since it seems to occur to a different and random majority each time).

The only way I can see where a new (if any) message has arrived is to click on each individual folder, which then un-bolds if no real new messages, or gets updated with the real (correct) new message count a few seconds after I highlight it (doing this for all 30+ folders isn't fun).

I'm running: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b4pre) Gecko/20090312 Shredder/3.0b3pre

Thanks,
     Aaron
I'm seeing this on Windows Vista, using IMAP against the German GMX mail provider.
We should at least investigate this apparent regression possibly caused by bug 428266 before the next beta. Setting blocking and assigning to David as he's probably the best one to look at this.
Assignee: nobody → bienvenu
Blocks: 428266
Flags: blocking-thunderbird3+
Keywords: regression
Whiteboard: [needs investigation to confirm blocking status]
Target Milestone: --- → Thunderbird 3.0b3
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Mac OS X → All
Hardware: x86 → All
I'm seeing this on Mac, using IMAP with Mozilla's Zimbra.
Also folder can become bold but don't show message numbers, while there new messages.
Attached file Part of IMAP log
I attached a part from my logging session.

It begins after a new messages finished downloading. Shredder than sat idling, until the folder "Mailinglists/Frisbee" turned bold (without an unread count in parenthesis). Maybe someone can get some insight from the log, but I don't see anything from the server suggesting that.
I disabled IDLE support to eliminate possible conflicts between IDLE and auto-sync. Still I just triggered the bug like this:

1. fearing that bug 483859 could be there I selected almost every folder
2. installed nightly update, forcing a restart
3. upon startup TB checked for new messages, bolding all the folders
   previously selected

Interesting tidbit: to sort things out I don't have to select folders again, hovering with the mouse pointer helps as well, I suspect triggering the calculation of the extended tooltip, which notices that actually no messages are there.
This log was recorded while I experienced this bug, many folders were bolded, but had no new-message-count. This startup followed immediately after the recording of Attachment #369040 [details] in bug 483859.
Just as an update (since it was previously suggested), re-indexing all folders did not help.

I recently followed these steps:
http://kb.mozillazine.org/Phantom_folders
(delete *.msf, delete panacea.dat) and shortly after re-launching Thunderbird, all but nine folders became bold/blue to indicate new messages.
(No 1000s of new messages count indicator this time, but that usually happened less frequently).

Running: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b4pre) Gecko/20090325 Shredder/3.0b3pre
Against a MS Exchange 2007 with IMAP server
Latest nightly seems to be better - I discovered duplicated .msf files in profile, so deleted everything except message filter files. On rebuild things are working again, as expected, no more erroneous "new mail" notices or bad message counts. Don't know if the duplicated files were due to new nightly or not - there were folders like (for example) Drafts, Drafts-1 and associated .msf files; I deleted all of it and restarted.

If a folder rebuild is necessary to stop this from happening, it will likely need to be done automatically on upgrade to avoid confusion.
Attached file possible fix (obsolete) —
I'd like to see if this helps - I still need to figure out the underlying issues, but we shouldn't be marking folders as having new if the unread count isn't > 0.
Attachment #369678 - Flags: superreview?(bugzilla)
Attachment #369678 - Flags: review?(bugzilla)
I've been poking around this code a bit more - I haven't reproduced the bug, but I can see where things would go wrong. I think the relevant change in bug
428266 was to persist the server counts, which I believe exacerbated some issues in nsImapMailFolder::UpdateImapMailboxStatus. That code treated differences in the server unread counts and db unread counts as pending unread count changes, and in some situations the pending unread count is getting confused. It's getting negative when it shouldn't (but just being negative isn't an error per se - e.g., we could have five unread messages in the db, but you could have marked them read on an other machine - in that case, after doing a status command, we'd have a pending unread count of -5 so that we would show 0 unread in the folder pane - when the user selected the folder, we'd reconcile all the headers+counts).
Attached patch proposed fixSplinter Review
This makes us maintain the invariant that the pending unread + the db unread == server unread. It also makes sure that we reflect changes to the db and panacea.dat.

I'd like to see if this helps with the problems folks have been seeing.
Attachment #369678 - Attachment is obsolete: true
Attachment #370118 - Flags: superreview?(neil)
Attachment #370118 - Flags: review?(bugzilla)
Attachment #369678 - Flags: superreview?(bugzilla)
Attachment #369678 - Flags: review?(bugzilla)
Does Mozilla Messaging have Tryserver infrastructure yet? Or could a dev please link to a test build with the patch?
(In reply to comment #15)
> Does Mozilla Messaging have Tryserver infrastructure yet? Or could a dev please
> link to a test build with the patch?

We're actively setting it up. At this time we only have OS X builds available.
Comment on attachment 370118 [details] [diff] [review]
proposed fix

>   PRInt32 previousUnreadMessages = (m_numServerUnseenMessages)
>     ? m_numServerUnseenMessages : GetNumPendingUnread() + mNumUnreadMessages;
>   if (numUnread != previousUnreadMessages || m_nextUID != prevNextUID)
>   {
>+    PRInt32 unreadDelta = numUnread - (GetNumPendingUnread() + mNumUnreadMessages);
>+    if (numUnread - previousUnreadMessages != unreadDelta)
>+       NS_WARNING("unread count should match server count");
      if (numUnread - previousUnreadMessages != unreadDelta)
=     if (numUnread - unreadDelta != previousUnreadMessages)
=     if (GetNumPendingUnread() + mNumUnreadMessages != previousUnreadMessages)
=     if (m_numServerUnseenMessages && (m_numServerUnseenMessages !=
          GetNumPendingUnread() + mNumUnreadMessages))
But even this belongs in an NS_WARN_IF_FALSE/NS_ASSERTION i.e.
NS_WARN_IF_FALSE(m_numServerUnseenMessages &&
                 (m_numServerUnseenMessages !=
                  GetNumPendingUnread() + mNumUnreadMessages),
                 "unread count should match server count");
You can now also get rid of previousUnreadMessages.
Attachment #370118 - Flags: superreview?(neil) → superreview+
I would be happy to test and provide feedback on any fixed builds as I am dealing with this problem constantly. I see mentioned that "At this time we only have OS X builds available" but am not sure where to get them... I've been running the latest nightlies for a while now.
Whiteboard: [needs investigation to confirm blocking status] → [needs review standard8]
Attachment #370118 - Flags: review?(bugzilla) → review+
fix checked in - please let me know if this helps with the problem.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [needs review standard8]
I'm guessing this fix should be in the 20090407 build when it gets rebuilt tonight.  Still in the last 20090406 update I downloaded.
I've only been running the nightly with the fix for about an hour but already my workflow is much smoother =)

Thanks for committing the fix - as far as I can tell it is working well. I also noticed that aside from NOT getting the invalid unread/new message notifications now, I am also getting more reliable correct unread message counts (e.g. a folder that has an older unread message in it would not always show up bold or with an unread message count before. Now it always has the correct markings...)

Thanks!!!
Just restarted Shredder after installing latest nightly.  The first thing to happen was a folder came up in bold.  Click on it and no new messages.  Not fixed here.  Will keep running the latest build and report if there are any more issues, or the issue is resolved.
Counts and new mail folder decoration much improved for me as well. 

(In reply to comment #23)
> Just restarted Shredder after installing latest nightly.  The first thing to
> happen was a folder came up in bold.  

A folder will of course be bold if there are *unread* messages. Do you mean there are no unread messages in the bold folder?
There were no unread messages in that folder.  Interestingly, the issue seems to be resolved now. It was just that one folder at the first startup after the update.  Since then, works brilliantly.  Well done on fixing it.  Finally I only get a "new mail notify" sound when I actually get mail.
Also looks good for me as well.
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1b4pre) Gecko/20090407 Shredder/3.0b3pre
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: