Open Bug 1916107 Opened 1 year ago Updated 1 year ago

New count displayed on Taskbar icon reset resulting in too few messages (start reading at comment #28).

Categories

(Thunderbird :: OS Integration, defect, P2)

Thunderbird 130
defect

Tracking

(Not tracked)

People

(Reporter: anjeyelf, Unassigned)

References

Details

Attachments

(4 files, 1 obsolete file)

Attached image unread-count-1.jpg (obsolete) —

Windows 10 OS
Beta 130.0b3

In Settings > General
'Incoming Mails' section
click on 'App icon Options'
select 'Count of unread messages'
Force display to function by restarting Thunderbird

Thunderbird beta Icon badge on Taskbar says 77 unread messages.
Actual number of unread messages across two imap accounts and one pop account using Local Folders as Global Inbox is 608

What is being counted as 'unread' ?

Note: IF you only count the unread messages in Only the Inboxes of all accounts (2+9+45) the total is 56
But as most emails get auto filtered and moved to different folders when incoming - the unread mail is mainly not in an 'Inbox'.

What is counted depends on the setting of pref mail.notification.count.inbox_only. With default true, only inboxes are counted, to that the count of unread chat messages is added if you have chat configured.

With that pref at false, all mail folders are counted, not feeds and not news, not virtual/unified/Sent/Outbox/etc. folders (since they would cause double-counting). For me, currently, I have three mail folders with unread messages, and they add up correctly. Does the count get corrected if you visit the folder and repair it.

If you want to debug it, set pref mail.notification.loglevel to All, in the Error Console you can then see how the count is composed.

Hi Francesco - thanks for info.
In 130.0b3
Preference: mail.notification.count.inbox_only. is set as 'true'

No chat.
Just two imap accounts and one pop account set up using Global Inbox 'Local Folders'.

Using setting : View > folders > All
Not unified etc.

Followed advise and 'Repaired' all Inbox folders.
Each Inbox has the following count for unread: 4, 18, 46 = total 68
Icon on Taskbar says 89

set mail.notification.loglevel to All

Restarted Thunderbird
Each Inbox has the following count for unread: 2, 9, 46 = total 57
Icon on Taskbar says 78

Checked error console as advised.
Info says:
mail.notification: mailbox://nobody@Local%20Folders/Inbox has 46 unread MailNotificationService.sys.mjs:97:19
mail.notification: imap://name%40gmail.com@imap.gmail.com/INBOX has 2 unread MailNotificationService.sys.mjs:97:19
mail.notification: imap://name%40btinternet.com@mail.btinternet.com/INBOX has 9 unread MailNotificationService.sys.mjs:97:19
mail.notification: mailbox://mail%40mydomain.co.uk@mail.livemail.co.uk/Inbox has 21 unread MailNotificationService.sys.mjs:97:19
mail.notification: Unread mail count changed to 78 MailNotificationManager.sys.mjs:169:18

Discovered:
The pop account says 21 unread, but the pop account is not set up as a separate account - it uses 'Local Folders' Inbox which says 46

So it seems the count of pop is added again thus count is 78. (57 + 21)
That explains the count anomaly, but still seems odd.

But if all the pop account is in Local Folders Inbox why is it added as a separate account for the count ?
It looks like the count is including the pop account Inbox prior to swapping account to a Deferred account. So an unseen Inbox - not in Folder Pane because account is a deferred account.
In profile - the 'Mail' folder shows pop account and the Inbox has the 21 emails.

Emptied error console.
I exited Thunderbird
Access that profile pop Inbox and copied emails into a new mbox called 'Old Pop' which I put into Local Folders.
Then I emptied the pop account Inbox file - saved it and deleted the Inbox.msf file
It now says Inbox size is 0 and it really is empty,
So that account Inbox should now not be included as having unread mail.

REstart Thunderbird
I've got an 'Old pop' folder in Local Folders - so I can see those emails.
checked error console
But the count in icon on taskbar remained the same 78 and the pop account data still said it had 21 mails !
mail.notification: mailbox://mail%40mydomain.co.uk@mail.livemail.co.uk/Inbox has 21 unread MailNotificationService.sys.mjs:97:19

Hope this info helps to explain the issue.

In brief, the count is (somewhat) correct, only that there appears to be a problem with deferred account in "Local Folders". Maybe there is more information in the error console log. So the local inbox has 21 unread messages when it's in fact empty. Can you repair it?

UPDATE: Or move a message into it, make that message unread. See whether the count drops to 1.

So where do I find these variables?? mail.notification.count.*, etc??
In Firefox it is about:config, but that doesn't exist in Thunderbird...

(In reply to Daniel Miller from comment #4)

So where do I find these variables?? mail.notification.count.*, etc??
In Firefox it is about:config, but that doesn't exist in Thunderbird...

nevermind, Google answered quickly enough!

okay, I have mail.notification.count.inbox_only set to 'true', but my message counts are always wildly random...
I have two imap accounts that I monitor; this morning, I had one new message in one account, and several new messages in the other, but the taskbar icon just said 2, which didn't correlate to anything in my system...

I'm trying to locate where the data in error console is retrieved from.
Is the error console data retrieved from the 'folderCache.json file ?
mail.notification: mailbox://mail%40mydomain.co.uk@mail.livemail.co.uk/Inbox has 21 unread MailNotificationService.sys.mjs:97:19

'folderCache.json' file has this:

"C:\Users\User name\AppData\Roaming\thunderbird\Profiles\mni4eecl.default-beta\Mail\mail.livemail.co.uk" :
{
"expungedBytes" : 0,
"flags" : 28,
"folderName" : "",
"folderSize" : -1,
"pendingMsgs" : 0,
"pendingUnreadMsgs" : 0,
"totalMsgs" : -1,
"totalUnreadMsgs" : -1
},
"C:\Users\User name\AppData\Roaming\thunderbird\Profiles\mni4eecl.default-beta\Mail\mail.livemail.co.uk\Inbox.msf" :
{
"expungedBytes" : 0,
"flags" : 4100,
"folderName" : "Inbox",
"folderSize" : 646121,
"pendingMsgs" : 0,
"pendingUnreadMsgs" : 0,
"totalMsgs" : 21,
"totalUnreadMsgs" : 21,
"useServerRetention" : "1"
},

It seems the folderCache.json does not get updated if manually altering profile mbox and .msf files.
It seems the count does not take into account when a pop account is swapped over to use a Global Inbox, so unseen folders are being included in the count.

(In reply to Daniel Miller from comment #5)

(In reply to Daniel Miller from comment #4)

So where do I find these variables?? mail.notification.count.*, etc??
In Firefox it is about:config, but that doesn't exist in Thunderbird...

nevermind, Google answered quickly enough!

also https://support.mozilla.org/en-US/kb/config-editor/

(In reply to Anje from comment #7)

I'm trying to locate where the data in error console is retrieved from.
Is the error console data retrieved from the 'folderCache.json file ?

Yes, hence the suggestion to move a measage there and make it read/unread.

@Daniel: So you've configured to count new messages, not unread ones. You would need to follow the debugging output in the error console to see where the count comes from. Unread and new messages are different. New are the ones which have a yellow star. Note that the folder count shows the unread messages, not new ones, so an forder with display (8) may only contain one new message. IOW, (4) and (8) may still result in a new count of 2 on the taskbar.

Update
Exit beta
Access profile
renamed 'folderCache.json' to 'folderCacheold.json'

start Thunderbird
new 'folderCache.json' is ceated.
It looks correct.
"C:\Users\User name\AppData\Roaming\thunderbird\Profiles\mni4eecl.default-beta\Mail\mail.livemail.co.uk\Inbox.msf" :
{
"expungedBytes" : 0,
"flags" : 4100,
"folderName" : "Inbox",
"folderSize" : -1,
"pendingMsgs" : 0,
"pendingUnreadMsgs" : 0,
"totalMsgs" : 0,
"totalUnreadMsgs" : 0
},

I've deleted several emails and have no unread in Local Folders so count has changed but it now seems correct.

In error console info has updated:
mail.notification: mailbox://mail%40mydomain.co.uk@mail.livemail.co.uk/Inbox has 0 unread MailNotificationService.sys.mjs:97:19

Just to check I sent email to the pop account - received in Local Folders Inbox
Count is updated and correct in ask Bar icon.

Whilst this has sorted my count issue, this investigation has shown that:

  • moving a pop account to a deferred account using Global Inbox does not reflect this in the count as the unused Inbox is still counted.
  • the folderCache.json seems to provide info on what is included in the count
  • to fix it requires a manual kill of profile data and folderCache.json file to get the count corrected. - I'm able to do this but not user friendly.

Would it not be better to not include account Inbox when account is set to use Global Inbox 'Local Folders' so count is correct ?

There may be other reasons why a count of unread is incorrect in Task Bar but the above info at least has enlightened on one cause.

folderCache.json should not be removed, since it will cause TB to visit all folders in the system which can be problematic for large profiles with many folders. You can edit the JSON file in an editor correcting or removing incorrect entries.

As for the deferred inbox: Are you saying that messages are counted twice, once in the account's inbox and once in the global inbox. That shouldn't be the case. Or did you just have some stale data for the account's inbox. IOW, if you now receive a message on the POP account, does the count go up by 1 or 2?

Hi Daniel
Depends upon what is set up here:
In Settings > General
'Incoming Mails' section
click on 'App icon Options'

I was counting 'unread' messages which includes both new since last looked in folder and also previously downloaded but unread. Because regardless of whether new or not - unread includes both.
So I had selected 'Count of unread messages' option.

'Count of new messages' is selected by default
That count means 'new' in Inbox since you last looked in Inbox. So if you select Inbox but do not read new emails, then they become just 'unread' not 'new and unread', so you may have what you call new mail but it's no longer classed as 'new'. That will effect the Taskbar icon count.

Daniel Miller - What option have you got selected ?

(In reply to Francesco from comment #11)

folderCache.json should not be removed, since it will cause TB to visit all folders in the system which can be problematic for large profiles with many folders. You can edit the JSON file in an editor correcting or removing incorrect entries.

As for the deferred inbox: Are you saying that messages are counted twice, once in the account's inbox and once in the global inbox. That shouldn't be the case. Or did you just have some stale data for the account's inbox. IOW, if you now receive a message on the POP account, does the count go up by 1 or 2?

The accounts pop Inbox had old emails from time when it was a normal account using it's own set of folders. I had not bothered to move them prior to swapping over to a Global Inbox using Local Folders. But those emails were the 21 included in the count because they were still marked as unread.
The Global Inbox had emails received since set up as a Global Inbox - the count is accurate for this.
So Not a duplicate of actual emails.

Currently new received emails go to Local Folders Inbox and count is correctly incremented.

So if a pop account has old unread mail which is left in account Inbox and then you change settings to swap over to use Global Inbox(Local Folders) , the count of the now not used Inbox continues to be included in the total displayed in Taskbar icon.

(In reply to Anje from comment #13)

So if a pop account has old unread mail which is left in account Inbox and then you change settings to swap over to use Global Inbox(Local Folders) , the count of the now not used Inbox continues to be included in the total displayed in Taskbar icon.

OK, but the account's inbox is still present in the folder list with unread messages? Then clearing the unread messages should decrease the count. Or is that inbox hidden?

(In reply to Anje from comment #12)

Hi Daniel
Depends upon what is set up here:
In Settings > General
'Incoming Mails' section
click on 'App icon Options'

I was counting 'unread' messages which includes both new since last looked in folder and also previously downloaded but unread. Because regardless of whether new or not - unread includes both.
So I had selected 'Count of unread messages' option.

'Count of new messages' is selected by default
That count means 'new' in Inbox since you last looked in Inbox. So if you select Inbox but do not read new emails, then they become just 'unread' not 'new and unread', so you may have what you call new mail but it's no longer classed as 'new'. That will effect the Taskbar icon count.

Daniel Miller - What option have you got selected ?

Okay, in "App icon options", I have "Count of new messages" selected...
However, in the previous "Incoming Mails" section, I had "Show a tray icon for unread messages" checked, which I don't think I wanted, since I only want the taskbar to show new messages; I have now unchecked that box, and will see what happens now...

I might note, though, that in most cases, the taskbar icon count does not match any of 'new', 'unread', or 'new + unread'... but I'll collect data on this again, and submit it in the morning...

(In reply to Francesco from comment #14)

(In reply to Anje from comment #13)

So if a pop account has old unread mail which is left in account Inbox and then you change settings to swap over to use Global Inbox(Local Folders) , the count of the now not used Inbox continues to be included in the total displayed in Taskbar icon.

OK, but the account's inbox is still present in the folder list with unread messages? Then clearing the unread messages should decrease the count. Or is that inbox hidden?

That pop account Inbox is hidden. You have to exit Thunderbird and access the relevant mbox file in profile and empty the contents, then save file and then delete the Inbox.msf file.
After a restart of Thunderbird, unfortunately, this did not update the 'folderCache.json' file, so issue was not resolved at this point.

Hence, exit Thunderbird again, access profile and I renamed the 'folderCache.json' to force a new refresh folderCache.json file - when I restarted Thunderbird again - that did sort the issue as the new folderCache.json updated the hidden pop Inbox data.

I think that process may be not so easy for some people, but with your guidance on what preferences to set, I was able to trace where the missing 21 was lurking.

I did not expect unused or hidden account data to be used.

It makes you wonder if removing pop accounts may cause a similar count problem because whilst the account is no longer visible in Account Settings nor Folder Pane, the mail account data remains in the Mail folder - so does it remain in the folderCache.json' file ?
I'm just throwing that in to the mix as a possible another reason for weird counts.
It depends upon what triggers the 'folderCache.json' file to get updated.

(In reply to Anje from comment #16)

That pop account Inbox is hidden..

So the bug is really that the count of a hidden inbox is included. Perhaps the folder shouldn't be hidden at all.

Instead of deleting files on the OS level, a simple fix would have been to return the account to a regular inbox, cleaning that up and then deferring again.

(In reply to Anje from comment #12)

Daniel Miller - What option have you got selected ?

Okay, here is my current demonstration of this bug:

in "App icon options", I have "Count of new messages" selected...
in the previous "Incoming Mails" section, I have "Show a tray icon for unread messages" UNchecked.
I quit and re-started Thunderbird after making these changes...

Just now I have observed my new messages; as seen in the accompanying messages,

taskbar icon shows 4, presumably meaning '4 new messages'...
I actually have 6 new messages
ITM, I have 12 (9+3) unread messages, 6 of which are not new

So no matter how you second-guess this situation, the taskbar count cannot have any meaning...

https://www.flickr.com/photos/derelllicht/53965703357

So, could we get this bug entered as an actual bug, and maybe finally get it fixed? I've been reporting it for years now, going back to the pre-rewrite version.

My system:
Windows 10 Pro 64-bit
Thunderbird 130.0b3 64-bit, though that is pretty much irrelevant for this bug.

oops... correcting previous post:
:s/accompanying messages/accompanying image/

OK, so you have a unified folder with 12 unread messages, which is the 3 + 9 on the individual inboxes. Of these 12, 6 are new. So the taskbar should display 6 and not 4. The only thing I can suggest is to set pref mail.notification.loglevel to All and submit the content of the Error Console as a text attachment (please don't paste in to a comment). You can right-click into the Error Console and select "Save all Messages to File".

Before you do this, repair the two inboxes: Right-click, Properties, Repair Folder.

Okay, I'll do that...

I noticed an interesting item, which may or may not be related to this topic??
I did the Repair Folder operation that you suggest, on derelict@comcast.net, which has 6 unread messages...
When I clicked Repair Folder, it changed to 12 (unread) in the folder display...
When I clicked Repair Folder again, it changed to 18 (unread) in the folder display...

I don't seem to be able to get it to correct that number!! It's now stuck at 18, but there are only 6 unread messages in the folder...
ITM, the Global Inbox still just shows 6, which is correct...
Is this a known issue, with a known fix?

Another question; how do I attach a text file (or any other attachment) to messages here?? I don't see any option for that, which is why I included a link to Flickr for my previous image...
I tried drag-and-drop from explorer, that did not work.

BTW, that second issue about Repair and unread count changing;
When I closed and re-opened Tbird, that corrected itself, so don't worry about that.

Yes, the repair messes up the count, you need to restart, see bug 1913224. The fix for the bug will come in TB 131 beta in the next few days.

Since you're counting new messages, the unread count is not important. When you post the next occurrence, please also include the new count in the individual inboxes. The following information is necessary: New messages in each inbox, new messages in the unified inbox, taskbar badge count. Note that when you're clicking onto the second inbox after inspecting the first, the new messages in the first inbox will no longer be counted as new. On the positive side: Your "two inbox" setup with a global folder shouldn't be hard to debug provided that you submit the log.

To attach a file, use the [Attach New File] button above in the Attachments section.

huh... there is NO [Attach New File] button, anywhere on this web page, with the sole exception of the original post...

and I have no idea how you want me to show the new-message counts on each of the entries; should I take a screen shot, then type in the values on each line (that actually would be easy to do...).

There is exactly one [Attach New File] button about 650px from the top of the page.

No screenshot needed, just report the numbers.

(In reply to Francesco from comment #26)

There is exactly one [Attach New File] button about 650px from the top of the page.

OMG !!! (looking at the page carefully, probably for the first time...)
I thought that button applied just to the original post!! Now that I'm looking at that entire region more carefully, I realize that several of those fields apply to the entire thread!!

Wow... I didn't expect that; in most forums and discussion groups that I've used, file operations, links, and other edit operations were connected to the individual post... I didn't expect it to work this way...

Okay, I gots it now... thanks for your patience!
I'll have this info in the morning...

Anyway, you can stop, I've just reproduced the issue.
Three inboxes, 2 + 0 + 2 new, unified inbox: 4 new. Taskbar shows 2. Error Console has:

mail.notification: Unread mail count changed to 1 MailNotificationManager.sys.mjs:169:18
mail.notification: Unread mail count changed to 2 MailNotificationManager.sys.mjs:169:18
mail.notification: Unread mail count changed to 0 MailNotificationManager.sys.mjs:169:18 <--
mail.notification: Unread mail count changed to 1 MailNotificationManager.sys.mjs:169:18
mail.notification: Unread mail count changed to 2 MailNotificationManager.sys.mjs:169:18

So it counts up to 2, then resets, and counts up to two again. I assume that without the reset, it would have counted up to 4.

Some developer needs to look at this now.


Sadly this bug had to issues mixed together, so I'm changing this now to reflect Daniel's issue. @Anje, can you please file a new bug about the global inbox issue.

Summary: unread count displayed on Taskbar icon incorrect → New count displayed on Taskbar icon reset resulting in too few messages (start reading at comment #28).
Attached image 1916107.png

Illustrating comment 28.

Attachment #9421970 - Attachment is obsolete: true

(In reply to Francesco from comment #28)

Sadly this bug had to issues mixed together, so I'm changing this now to reflect Daniel's issue. @Anje, can you please file a new bug about the global inbox issue.

Recreated original bug report as requested and inputted all relevant info.
See Bug 1916455

(In reply to Francesco from comment #28)
I think there's much more mail.notification info logged. It would be helpful to see what, since then I think also which folders are affected would be logged.

Sure, it logs a lot more, I've just extracted the lines that lead to the wrong count. Wouldn't it be better for a developer to reproduce this? It's easy to set up with two inboxes and a unified folder. Perhaps the latter isn't even necessary.

Well, here's my error log from overnight... not very useful, sadly...

Well, I have two interesting results from this overnight run...
First, as seen in previous message, the error log doesn't appear to work on my installation...
Second, and very oddly, the taskbar count was correct this morning!! 1 new message in derelict@comcast.net, 3 new messages in dan7miller@comcast.net ... that's has to be a first !!

The only things I did differently were (1) turn on error logging, and (2) briefly turned on 'Recipient' column, so I could see which address the messages were to, from the Global Inbox...

I'll keep watching and see what happens in coming days.

Attached image Tbird error counts.jpg

next error count report, 09/04/24
Total new messages: 5
derelict@comcast.net: 1
dan7miller@comcast.net: 4
TBird taskbar count: 3

Unfortunately, Tbird error logger is still not providing any reports, just lots of error messages.

different count errors this time

Well, I got a different count error this morning...
There are 8 new messages (4 in derelict, 4 in dan7miller), but the taskbar icons don't show anything at all.
See attached 'tbird new count errors 09.05.24.jpg' ...

francesco@angel94.eu ;

You noted in Comment 28 that you were able to reproduce the issue...
Did this this issue ever get assigned to a developer??

You can see in the header that the bug is currently unassigned.

(In reply to Francesco from comment #39)

You can see in the header that the bug is currently unassigned.

hmmm... in fact, nothing has been done with it; no priority, no severity, nothing...
yet this bug has been present for years, going back to pre-beta...

What would be required to get this marked as a real issue?

Thanks for the report, we're aware of this issue and we will get to it when we have time.
We're currently dealing with other higher priority issues affecting ESR, so apologies for the lack of feedback.
Thank you all for the STRs and detailed report.

Severity: -- → S3
Priority: -- → P2

(In reply to Alessandro Castellani [:aleca] from comment #41)

Thanks for the report, we're aware of this issue and we will get to it when we have time.
We're currently dealing with other higher priority issues affecting ESR, so apologies for the lack of feedback.
Thank you all for the STRs and detailed report.

Thank you very much for this update!!
I understand having higher-priority issues to deal with!!
I'm pleased just to see this one touched and updated...

See Also: → 1935383
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: