Open Bug 1924420 Opened 1 year ago Updated 1 month ago

thunderbird freezes when checking mail after updating to 128.3.1esr (64-Bit). But not with Windows Defender disabled / exclusions

Categories

(Thunderbird :: General, defect)

Thunderbird 128
defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: Copter, Unassigned)

References

Details

(Keywords: hang, perf, Whiteboard: [caused by windows defender "cloud protection" feature])

Steps to reproduce:

Use windows 10 version 22H2 build 19045.5011
Start thunderbird 128.3.1esr (64-Bit)
Optional: receive new mail, click on mail in inbox

Actual results:

Thunderbird freezes for about 10 seconds when launching the program, the window loses focus and the spinning circle cursor appears. This also happens when clicking on new mails, and whenever a new email is received while thunderbird is running (in which case the notification sound plays but the window freezes).
I have not changed my configuration at all since before the update, neither thunderbird's nor my mail provider's. This issue did not occur before the update, but started immediately after the update. The program is borderline unusable.
On another note the new UI sucks big time, but that's another story.

Expected results:

thunderbird should load and display mails without delay, like in the previous version.

UPDATE
updated thunderbird to 131.0.1 (64-Bit) (version currently marked as "Release")

problem still occurs.

Also, the freezes seem to only occur during loading of new mails. refreshing the inbox with no new mails does not trigger the freeze. Any new mail will cause a freeze.

UPDATE 2
installed BETA 132.0b3 (64-Bit) (version currently marked as "BETA")
imported account from other TB installation
problem still occurs.
launched TB in troubleshooting mode, problem still occurs.

installed DAILY 133.0a1 (2024-10-13) (64-bit) (version currently marked as "DAILY")
imported account from other TB installation
problem still occurs.
launched TB in troubleshooting mode. Problem. Still. Occurs.

The problem can easily be reproduced by simply sending a mail to yourself using an online mail interface or Thunderbird itself.
New mail will show up in the inbox, the inbox sound may play, then TB will instantly freeze for about 10 seconds.
The content of the email can literally be blank.

The problem did not occur with the version I used prior to the "supernova" update. I tried to check which version I used to have, using the update history, but it doesn't show my old version. It was pre-115 in any case.

My account is IMAP. That's about it from my end.

MAJOR UPDATE

booting windows 10 in safe mode with networking seems to fix the problem. Win 10 version according to msconfig is 22H2 build 19045.5011
Safe mode screen says Build 19041.vb_release.191206-1406

I can't really tell if any windows updates coincide with when the freezes started. It's been going on for several months, since right after updating to Thunderbird 115.11.0
closest win updates are
KB5039211
KB890830

I reinstalled Thunderbird 102.15.1 (64-Bit) seperately, imported all my data from a .zip file. And the freezes happen there too now, even in trouble shooting mode. So I don't even know anymore. TB then auto updated itself to 115.10.1 (64-Bit), problems persist.

So yeah I'm out of ideas for now besides reinstalling my mail account or switching to POP or double checking my firewall (I'm using windows defender but never received any firewall warnings, besides I AM receiving mail, it just freezes.), and of course the fact that windows safe mode with networking fixes it

should also mention it's ONLY the current TB instance that freezes, NOT windows.

ALSO: I'm seeing a CPU spike when a freeze occurs - this does not happen in win safe mode. My CPU is old but not THAT old. (intel core i5 quadcore)
I also have plenty of ram and free disk space. Nvm the fact that the requirements for TB are stated as "1GHz or faster Intel/AMD compatible processor" so it's not a hardware issue obviously. Windows update history shows no driver updates in the timeframe when the freezes started.

Keywords: hang

MAJOR UPDATE 2 - TEMPORARY FIX

So after digging into the CPU spikes, I've discovered the problem is caused by windows defender, specifically the "cloud protection" feature.

As a workaround, one can do the following:
(on windows 10)(may need admin privileges)

A: Go to settings -> update & security -> windows-security ->Virus & threat protection -> settings for Virus & threat protection -> manage settings -> turn Cloud Protection OFF
OR
B: On the same screen, scroll down to Exceptions -> add or remove exceptions -> add exception -> process -> add full path to thunderbird.exe, e.g.: C:\Program Files\Mozilla Thunderbird\thunderbird.exe

A system restart shouldn't be required, but it is advised to make sure the changes take effect.

This fixes the freezing issue on ALL tested versions.

(all other settings don't seem to matter, so real-time protection can stay ON)(attempting to disable RT protection only may work as Cloud protection apparently depends on RT to run, but with cloud enabled RT will be automatically re-enabled on every restart.)(turning off Cloud protection obviously disables it globally for all programs, using RT still, whereas the exception will preserve cloud globally but completely disable protection on thunderbird.)


So even though on the surface it seems like a problem caused by a windows update or something, it might be a good idea for someone in the TB dev loop to take a look at this. Maybe they can fix it from their end. I doubt Microsoft support will care much about this, they might just chalk it up to "feature, not bug".
Still, I think this is an issue that could affect a lot of TB users, theoretically anyone on Windows 10 or even Windows 11 with any TB version could be affected. I tested it from 102.15.1 over 128.3.1esr., BETA to DAILY 133.0a1 (2024-10-14) (all 64-bit versions, haven't tested 32bit)
The problem appeared suddenly without changing any windows settings, and windows defender is enabled by default for all windows users, including I believe, the Cloud protection feature.
I don't think simply turning off the Defender protection is a permanent fix, and many users might hesitate to do so out of security concerns.

If there is nothing to be done about this, you may want to send out a notice to users or add it to the FAQ, knowledge base, whatever, so users can find it and fix it if they encounter freezes.

(Also, a moderator may want to change the topic title to something along the lines of "Windows defender can cause Thunderbird to freeze when receiving mail", to reflect the issue better and help people find this thread.)


Should be fairly easy to reproduce now:

  1. Use Windows 10 (tested on 22H2 build 19045.5011)
  2. Disable or uninstall any 3rd party security software, as they usually override windows defender
  3. Make sure windows defender real time protection and Cloud protection are enabled and there is no exception for thunderbird. (the other defender settings don't seem to matter, firewall doesn't seem to matter either, according to my tests)
  4. Restart your PC just to make sure
  5. open up thunderbird, send yourself a new email, refresh inbox. Any mail will do. My account is IMAP but idk if account config matters.

Relevant processes include:
MsMpEng.exe "C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.24080.9-0\MsMpEng.exe" aka "WinDefend" "Antimalware Service Executable" - the process that hogs CPU
and
NisSrv.exe "C:\ProgramData\Microsoft\Windows Defender\Platform\4.18.24080.9-0\NisSrv.exe" aka "WdNisSvc" "Microsoft Network Realtime Inspection Service"

Issue began approx. in may-june 2024.

Again, bugged behaviour is: When receiving new mail, TB instance freezes for about 10 seconds showing spinning cursor and visible CPU spike on MsMpEng.exe.

Can you reproduce comment 5

Flags: needinfo?(vlucaci)
Whiteboard: [caused by windows defender "cloud protection" feature]

UPDATE 3 - good news, bad news.

I tried deleting the global-messages-db.sqlite according to
https://support.mozilla.org/en-US/kb/rebuilding-global-database
didn't fix the freezes, although I only tried it once.

I then decided to delete and remake my mail account, and surprise! No more freezes on the new profile. I used the exact same settings.

I ended up just deleting all traces of Thunderbird, including all my user data and profile folders, reinstalling the latest ESR and remaking my profile. No more freezes, even with Defender cloud protection on and no exceptions set. I should note that I had to redownload about 14k emails, it started freezing periodically at the 8k+ mark, but once all were downloaded, TB behaved normally. My imapMail folder is 1GB. Again, I don't think it's a hardware issue since the freeze bug CPU spikes never went to 100%, only around 60%, and the computer itself was still responsive while TB was frozen, so it looks like the bottleneck is software.

So,

Good news #1, I found another solution (remaking your mail account, Pros: no need to mess with Defender. Cons: losing your settings and local data)
Good news #2, I've narrowed the bug down further, it's tied to a corrupted profile somehow. My guess is the update from 115 to supernova messed something up in the profile that causes windows defender to act up, perhaps compounded by having a large mail folder. Maybe some file permissions weren't set correctly or something. No idea. Keep in mind it's something that isn't affected by troubleshooting mode, since that didn't fix it. Maybe this is related to a known/fixed bug?

Bad news, you probably won't be able to reproduce it so easily after all. Sorry.

My current status is, I reinstalled TB beta separately and I have a backup of the bugged profile. I can still reproduce the bug by simply importing the bugged profile.zip into any TB installation.
I wish I could just share the profile, but obviously I can't since it contains all of my mail and account info.

When I find the time I'll try to isolate it some more, but I don't know how much more I can do at this point.
My best lead so far is that the updater corrupted my profile somehow when going from 115 to supernova.

If there's anything else you'd like me to try, let me know.

TL:DR recap
used profile pre 115 without issues, update to 115 broke something in the profile. Bugged profile, when used in any tested TB installation now causes freezes when loading new mail at a rate of approx. 10sec per new mail. Tied to Windows Defender. Fixed by remaking profile or disabling defender cloud protection/adding exception. Win 10.

I've been seeing more reports lately of Windows Defender issues.

https://wiki.mozilla.org/Thunderbird:Testing:Antivirus_Related_Performance_Issues talks about these issues. I've just added this example.

Keywords: perf
Summary: thunderbird freezes when checking mail after updating to 128.3.1esr (64-Bit) → thunderbird freezes when checking mail after updating to 128.3.1esr (64-Bit). But not with Windows Defender disabled / exclusions

Having suffered with this problem for several months on my Windows 10 laptop and thus seriously considering abandoning Thunderbird, I was very pleased to see that others have been able to reproduce it. I didn't associate the freezes with a Thunderbird update, which puzzles me because I use the "notify me and I'll decide whether I want to perform this update" approach. So if a problem results, there is a timely cause-and-effect relationship and I don't have to wonder whether Thunderbird updated without my noticing.

I took Copter's suggestion "B" since I didn't want to interfere any more than necessary with anti-malware protection:
B: On the same screen, scroll down to Exceptions -> add or remove exceptions -> add exception -> process -> add full path to thunderbird.exe, e.g.: C:\Program Files\Mozilla Thunderbird\thunderbird.exe

This seems to have solved the problem, at least for the last several hours. And I've been using email more than enough this evening to be startled that the distressing delay seems to be taking a vacation. Which I certainly hope will be permanent.

Martt

Flags: needinfo?(vlucaci)
You need to log in before you can comment on or make changes to this bug.