msgsClassified event may fire multiple times for a single message

RESOLVED FIXED in Thunderbird 3.0rc1

Status

MailNews Core
Database
P2
normal
RESOLVED FIXED
8 years ago
8 years ago

People

(Reporter: asuth, Assigned: asuth)

Tracking

({fixed-seamonkey2.0.1})

Trunk
Thunderbird 3.0rc1
fixed-seamonkey2.0.1
Bug Flags:
blocking-thunderbird3 +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

8 years ago
It sounds like the problem where msgsClassified tells us about messages we already know about is worse than hoped for.

If a user receives a new messages in a folder, a msgsClassified event is generated for _all_ the messages marked as new in that folder.  Because we limit the number of event-driven messages to be indexed to 20 and the folder indexing sweep logic is pretty good, in the pathological worst-case we will:
- redundantly index 20 messages that do not need to be indexed
- undertake a filtered enumeration of the messages in the folder (C++ enumeration of all headers)
- index the messages that actually are new and have not been indexed

This problem likely interacts with fast-pathing IMAP moves and the un-delete case.  Unfortunately, there may be no zero-cost solution since we may be unable to easily disambiguate amongst all the possible cases and so always have to perform a db lookup to check the message's location to see if we need to update it.  We might be able to mitigate by marking messages using processing flags during the msgAdded event assuming those get cleaned up if the message ends up getting moved by the spam detection.
Flags: blocking-thunderbird3?

Updated

8 years ago
Flags: blocking-thunderbird3? → blocking-thunderbird3+
Priority: -- → P2

Updated

8 years ago
Target Milestone: --- → Thunderbird 3.0rc1
(Assignee)

Comment 1

8 years ago
Created attachment 411518 [details] [diff] [review]
make msgsClassified only ever generate a single msgsClassified notification for a message v1

I should have just done this originally instead of bothering with the workaround.

This patch introduces a new processing flag that gets set on message headers just after we generate the msgAdded nsIMsgFolderListener notification.  We only generate a msgsClassified notification for messages with the processing flag and we clear it when we generate it.  This allowed me to remove the workaround from messageInjection.js which should improve our mozmill troubles.

I also tried to improve logic related to the processing flags.  Namely, I cause us to remove the processing flags for a header when it is removed from the database.  Additionally, I cause us to clear all processing flags when the folder gets compacted.  I opted not to clear the processing flags in the reparse case since one could make the case that in that situation either 1) there are no processing flags because this is a first-open-this-session case or 2) there should theoretically be no message key changes for a 'rebuild index' triggered by the user.

I think clearing the processing flags is probably important for the TraitsDone and FiltersDone which are arguably very close to being memory leaks and bad for correctness in the face of compaction.  (Although there is some mitigation in the IMAP case where UIDs have a high probability of playing right into the message key set's run-length encoding mechanism.  Local folders will not have consecutive message keys and will suck.)
Attachment #411518 - Flags: superreview?(bienvenu)
Attachment #411518 - Flags: review?(bienvenu)
(Assignee)

Updated

8 years ago
Summary: gloda needs to fast-path msgsClassified for already-indexed messages → msgsClassified event may fire multiple times for a single message

Comment 2

8 years ago
Comment on attachment 411518 [details] [diff] [review]
make msgsClassified only ever generate a single msgsClassified notification for a message v1

r/sr=me
Attachment #411518 - Flags: superreview?(bienvenu)
Attachment #411518 - Flags: superreview+
Attachment #411518 - Flags: review?(bienvenu)
Attachment #411518 - Flags: review+
(Assignee)

Updated

8 years ago
Blocks: 527834
(Assignee)

Comment 3

8 years ago
pushed to trunk:
http://hg.mozilla.org/comm-central/rev/12ceaa786d23

pushed to trunk:
http://hg.mozilla.org/releases/comm-1.9.1/rev/f34b497649e0
No longer blocks: 527834
Status: ASSIGNED → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED

Updated

8 years ago
Keywords: fixed-seamonkey2.0.1
You need to log in before you can comment on or make changes to this bug.