Open Bug 2001966 Opened 1 year ago Updated 20 days ago

mail messages mixup using exchange protocol - after move/delete the Subject is the one of the 2nd message, but the Sender and Body are from the 1st message.

Categories

(MailNews Core :: Networking: Exchange, defect, P2)

Thunderbird 145
defect

Tracking

(Not tracked)

People

(Reporter: giunta.gaetano, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(9 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0

Steps to reproduce:

After moving (or deleting? I forgot the exact action) a mail message from the message list, and clicking on the message next to it, the message pane shows a curious mix-up: the Subject is the one of the 2nd message, but the Sender and Body are from the 1st message.

The error persists after shutting down and restarting TB.

This is using an Outlook365 account, TB 145.0 and the "Microsoft Exchange Mail Server" connection type.

Actual results:

Attached image tb_outlook_error.jpg —

PS: I tried the following: right-click the "Inbox" folder - choose "Properties" then "Repair Folder".
At first, it seemed as if the folder got wiped out - no messages were displayed.
Then the message list came back, but clicking on any message would not show up anything, just a blank message pane.

(This might be due to the fact that I'm on a slow 4G connection, bit it's still not a very friendly user experience I think. The interface could show some "loading" placeholder icon imho while data is loading instead of just an empty space...)

Finally, the message bodies started showing up. But still, when I click on the message with subject "[Circular Revolution Co-op CIC] Subscription Switched (4694) - 21 November 2025", I see the body of the message sitting just below it in the Inbox - which atm is not the one in the screenshot above, but another message...

Component: Untriaged → Networking: Exchange
Product: Thunderbird → MailNews Core
Summary: mail messages mixup using exchange protocol → mail messages mixup using exchange protocol - after move/delete the Subject is the one of the 2nd message, but the Sender and Body are from the 1st message.

PPS: I have either moved to subfolders or deleted the messages which were showing signs of "mixup", but the issue is persisting - today I see it happening with fresh emails (see 2nd attachment picture)

See Also: → 2002241

This looks like the local store is getting corrupted. I'm thinking this might indicate that we have an issue with synchronizing the local data store for the async threaded requests in the rust EWS client. Since it persists across a restart, this is not a temporary issue caused by the slow connection, but the slow connection may be showing us a thread synchronization issue. We need to investigate this one further.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2

Do not hesitate to let me know if there's any more data I can provide to help deeper analysis of the corruption of the local store.

I throttled my network connection and introduced a high probability of dropped packets and this is not reproducing for me. I'll try some other things, but it might not just be caused by network quality.

FYI: I did manage to fix the corruption by: removing the account in TB, stopping TB, removing the on-disk folder "Mail/outlook.office365.com" within the TB profile, then starting TB and setting up the account again from scratch (TB did remember the password for that account, somewhat unexpectedly).
I have a backup copy of the "corrupted" Mail/outlook.office365.com folder, if it might help...

...aaand, I got the corruption again.

The pattern to trigger it is the same: move a message from the outlook inbox to another folder, while messages are being downloaded (over a 4G connection).

I am not 100% sure about which messages where being downloaded at that exact moment, if it was the list of messages, the body of the message I was moving, or the body of the message next to it - I think that I quickly clicked on all the new messages in the inbox, without waiting for them to show up (ie. for their bodies to be fully downloaded and parsed), then moved one of the new messages.

ok, thanks for the update. I'm investigating this further today with network throttling to simulate the lower bandwidth connection.

ps: it "feels" as if TB was first calculating the list of messages to be downloaded, based on their position in the inbox, then downloading their bodies and assigning them to the messages based on their list position, without checking that that the list contents had changed in the meantime

Every message has a unique EWS ID that we get when we first fetch the headers (prior to fetching the body). When we move a message, we get a list of the resulting IDs back in the order specified by the initial move request, and we use the EWS IDs to request message bodies and associate them with their headers, so at least in theory we shouldn't be relying on any list ordering there, but that's a good point.

Here's a hypothesis (although I haven't been able to reproduce it): A message move is a copy, which generates a new ID, followed by a delete, all on the server side (see the working with identifiers section of the page on EWS identifiers). Exchange identifiers are opaque, and our assumption so far is that you won't have the exact same identifier for two different messages. However, if that's not true, then it could be possible that if we download a body during a move at the exact time after the copy, but before the delete, and we're fetching another message's headers after the moved message's ID is deleted that somehow ends up with the same ID, then we would associate the fetched body with the newly fetched header. This would rely on our assumption of the uniqueness of IDs being wrong and a really strange timing occurrence. MS's documentation does not provide any indication of what goes into EWS IDs and whether they get reused by the server. We've base64 decoded them in the past and the only recognizable content is a uuid.

Are you using an mbox store or a maildir store? Mbox is the default, so if you didn't change it globally in settings (it's at the bottom of the General section), then you're using mbox.

Flags: needinfo?(giunta.gaetano)

mbox store

Flags: needinfo?(giunta.gaetano)

Are you willing/able to share the headers for one of the problematic messages? If you want, you can send them to me directly, either via email (which would be legible to potential eavesdroppers unless you encrypt - I can send you a signed message if you want) or you can send them to me on Matrix.

Sure, I can share the headers of the problematic messages - I just need instructions on how to extract them (is that the "view source" menu item?)

Yes, but that also includes the body. It'd be helpful to see both both header and body source, but if you're not comfortable sharing the body, you can just grab everything above where you recognize the body content starting. Thank you!!

See Also: → 2004936
Attached file bad_msg_1.txt —
Attached file bad_msg_2.txt —

I have uploaded the requested data.
The current situation is: there are 3 "mixed up" messages in the inbox. 2 of those show the same body (the "order 4783").
When clicking on "More -> View Source", then saving the source via "save page as...", I get the exact same contents for the two messages which show the same body - hence why I uploaded only the 2 headers files instead of 3.

PS: I just noticed that, every time a message mixup happened, one of the two messages involved was coming from "Microsoft 365 Message center". This might be just coincidence, but I wonder if those messages get generated/delivered in a different way... (going back to the hypothesis that the source of the problem might reside within the EWS ids...)

Attached file good_msg.txt —

ps: I also attached the headers (and body) of one of the messages from MS Message center which does not present mixup issues, and which has a date close to a mixed-up message

pps: I just figured out that the Outlook web app also allows showing the message headers. So I downloaded the headers that it shows for the 3 messages that are mixed-up in TB and attached them as well (as a reminder: in the Outlook web app they show up with a body matching the sender and subject)

ppps: another tidbit of info: when deleting in TB the mixed-up messages:

  • in Outlook, they get sent to the Deleted Items folder
  • in TB, they also get moved to the Deleted Items folder, and they keep showing the mixed-up body

This is all really helpful information, thank you so much! I'll keep you posted on what we find.

FYI: I have now moved to using IMAP instead of EWS to access the given Outlook mailbox.

This has the slight discomfort of showing different folder names for some folders (due to Outlook shenanigans, I guess), and having to manually subscribe to see mail in all folders/subfolders, but so far has shown no sign of email header/body mixups.

As a side note: I read somewhere that EWS is being phased out by MS in favour of the Microsoft Graph API. How does that fit in TB's plans to support the EWS protocol?

Have you tried version 147 or higher? We made changes in 147 to improve concurrency in the operation queue that might address some of the issues you're seeing.

We are aware of the upcoming EWS phase out for Microsoft 365 and are currently implementing Microsoft Graph to continue support for Microsoft 365 accounts. For on-premises Exchange instances, Thunderbird will continue to support EWS as well. You can follow along with what we're currently working on for Graph in bug 1995835.

I am not 100% sure about the timing, but I think I moved from EWS to IMAP on 14 or 15 Feb 2026.
I did make an archive of the EWS mailbox, and looking it up I can see that the latest email I had marked as "mixed up" was sent on 5/2/2026.
Which means that I was most likely using EWS version 147.0.1 at that time.

Duplicate of this bug: 2086708
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: