After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 713910 - Unread count incorrect, changes quickly after startup
Unread count incorrect, changes quickly after startup
Status: RESOLVED FIXED
Product: geary
Classification: Other
Component: engine
master
Other All
: High normal
: 0.13.0
Assigned To: Geary Maintainers
Geary Maintainers
: 755147 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-10-01 01:46 UTC by Charles Lindsay
Modified: 2019-02-15 03:09 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Charles Lindsay 2013-11-21 20:23:55 UTC


---- Reported by chaz@yorba.org 2013-09-30 18:46:00 -0700 ----

Original Redmine bug id: 7579
Original URL: http://redmine.yorba.org/issues/7579
Searchable id: yorba-bug-7579
Original author: Charles Lindsay
Original description:

If you get a new message in your inbox, and switch to it to read it, Geary
will sometimes leave the folder's unread count at 1 (or 1 higher than is
accurate), even though it seems to be marking the message as read immediately.
I see this often, usually when I switch to a message soon after Geary first
sees it. When trying to reproduce, I seem to be able to trigger this nearly
every time by selecting the inbox as soon as the unread count changes and
clicking on the message right away. I assume it might be due to a timing hole
where we're marking the message and getting the unread count from the server
at the same time, or something.

Related issues:
related to geary - 7180: Use status command to get accurate unread count (Open)



---- Additional Comments From geary-maint@gnome.bugs 2013-10-04 15:36:00 -0700 ----

### History

####

#1

Updated by Jim Nelson about 1 month ago

  * **Priority** changed from _Normal_ to _High_

####

#2

Updated by Jim Nelson about 1 month ago

  * **Assignee** set to _Charles Lindsay_

####

#3

Updated by Charles Lindsay about 1 month ago

  * **Target version** changed from _0.4.0_ to _0.5.0_

####

#4

Updated by Charles Lindsay about 1 month ago

  * **Assignee** deleted (<strike>_Charles Lindsay_</strike>)

Talking to Eric, it sounds like there's no easy way solve this issue. We'd
need some way of rectifying the received count from the server with operations
we'd just done locally. Since we're done with the release, unassigning myself
for now.



--- Bug imported by chaz@yorba.org 2013-11-21 20:24 UTC  ---

This bug was previously known as _bug_ 7579 at http://redmine.yorba.org/show_bug.cgi?id=7579

Unknown milestone "unknown in product geary. 
   Setting to default milestone for this product, "---".
Setting qa contact to the default for this product.
   This bug either had no qa contact or an invalid one.
Resolution set on an open status.
   Dropping resolution 

Comment 1 Federico Bruni 2016-04-01 13:37:19 UTC
I think that the issue described here (wrong unread count when receiving duplicate replies, e.g. message sent to:me and Cc:alias) might be related:
https://mail.gnome.org/archives/geary-list/2016-April/msg00000.html

I must say that this is not happening with mailing lists, where I often receive duplicate emails but this does not affect the unread count.
This is specific of an alias account: alias@mydomain.com redirecting messages to myaddress@mydomain.com
Comment 2 Michael Catanzaro 2017-12-07 17:22:31 UTC
I see this problem regularly, although it is not limited to just new messages. Geary often just fails to update the number of unread messages.

The problem regularly occurs for me with mailing lists and also not-list mails.
Comment 3 Federico Bruni 2017-12-15 12:40:12 UTC
The issue I were talking about in comment #2 has been then reported as bug #764581.

This issue recalls me another similar one, as it's about duplication of unread count.
My regular experience when I first launch Geary is that the unread count is initially the exact double of the real number. After some seconds (20, 30 or more depending on the situations) it displays the right number.
Perhaps what was described here by Charles is just the same thing but limited to one message.

Note: the notification of new mail get the number right immediately.
Comment 4 Federico Bruni 2017-12-21 12:20:57 UTC
Further to above, the unread count in inbox often follows this pattern:

right count
double count
right count

The speed probably depends on quality of network connection and number of messages to sync.
Comment 5 Michael Gratton 2018-03-05 01:40:40 UTC
At least part of this problem is caused by Geary trying to use both the locally cached message count and the remote count, whichever is more recent, to determine the count authoritatively rather than just displaying what is cached locally. This is made more complicated however by the fact that Geary supports having a partial list of conversations downloaded for a folder, so we can't simply count messages in the database.

The easy way out would be simply to download minimal details for all messages in all folders so we can just count messages in the local database, but that doesn't scale for sites with very large numbers of shared folders, or on restricted clients such as mobiles.

I have a feeling that in general, for IMAP folders we want to update the absolute totals from the remote when a folder's remote is first opened, then make relative adjustments as user operations like mark read/unread are applied or as notifications of remote changes are received. This should be the case already, but the code is rather byzantine so it's hard to know.

So a good first step towards solving all this would be to remove Geary.AggregatedFolderProperties altogether and always use the local folder's properties in Geary.Folder instead, updating that when open from the remote's only during normalisation, or if the folder is closed and hence won't be receiving any relative adjustments (i.e. in UpdateRemoteFolders).

A second step is to ensure that the folder normalisation process is atomic to users, in that all changes are applied before the UI is updated. One way to do this would be to introduce an "updated" signal for Geary.FolderProperties so that API callers don't need to use notify signals on FolderProperties' GObject properties. This should take care of the flickering at startup.

We'd then need to check the codepaths that are updating the totals and ensure they are doing the right thing. In particular, we need to ensure that local operations like flagged a message as read or deleting an unread message are reflected immediately in the local properties, and that when remote notifications for these ops come though after the changes are applied to the remote folder, that we don't re-apply them.
Comment 6 echosa 2018-07-02 11:14:53 UTC
I've been redirected here from https://gitlab.gnome.org/GNOME/geary/issues/13.

Is there a currently workaround to fix the unread count while a permanent solution is being worked on? I don't see a "mark all as read" option anywhere. I tried selecting all the messages in the Inbox, then doing a "mark as read", but that didn't fix it.
Comment 7 Michael Gratton 2018-07-11 12:53:19 UTC
*** Bug 755147 has been marked as a duplicate of this bug. ***
Comment 8 Michael Gratton 2019-02-15 03:09:34 UTC
Fixed by https://gitlab.gnome.org/GNOME/geary/merge_requests/107