Closed Bug 1877142 Opened 1 year ago Closed 9 months ago

Thunderbird >100% cpu load after being in background for around 20 minutes [macos]

Categories

(Calendar :: General, defect)

Thunderbird 115
defect

Tracking

(thunderbird_esr115 wontfix)

RESOLVED FIXED
126 Branch
Tracking Status
thunderbird_esr115 --- wontfix

People

(Reporter: hirayasar, Assigned: mkmelin)

References

Details

(Keywords: perf)

Attachments

(1 file)

Steps to reproduce:

macos sonoma 14.2.1 on M3 max macbook. Thunderbird 115.6.1

Whenever i leave Thunderbird open in the background but with its window closed (default behaviour when you click the close button) it waits for some time then burns through the battery and considerably warms up my laptop. Moment i bring it in foreground power consumption becomes negligible.

I'm syncing 4 inboxes. 2 gmail, 1 outlook, 1 icloud. Only notable thing about them is i dont delete emails so they are pretty large. My personal gmail has been saying 95% of storage used(out of 25 gb afaik) since some time.

Actual results:

You can just about see when it decides to burn power in the battery graph of Activity Monitor.

https://i.imgur.com/Wdw3ERT.png

This is 3 screenshots of "Activity Monitor" as it happens. Coconutbattery shows 24 watts of power use. Also its using 30 gbs of memory.

https://imgur.com/a/14P1BzR

This is a 100 ms sampling rate profiling over 40 minutes capturing when it happens (around 23 minute mark)

https://share.firefox.dev/47CjsZD

This is a 1 ms sampling rate profiling taken as it happened.

https://share.firefox.dev/3Hpk1Lt

Expected results:

Thunderbird should have idled away in the background.

julienw indicates we should look at https://searchfox.org/comm-central/source/calendar/providers/caldav/modules/CalDavSession.sys.mjs#85-87

"if there's no window it keeps rescheduling something
it seems to be the case here, as the last window is closed
(the flamegraph in javascript mode pointed to this function)"

Flags: needinfo?(vseerror) → needinfo?(mkmelin+mozilla)

I think we can just remove this old workaround.
Nowdays we (normally) prompt for primary password before any window (security.prompt_for_master_password_on_startup).
That has its own issues (see bug 1882214).
But, even so, CalDAV requests do not seem to trigger before we have any window.

Assignee: nobody → mkmelin+mozilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(mkmelin+mozilla)

(In reply to Magnus Melin [:mkmelin] from comment #2)

Created attachment 9395528 [details]
Bug 1877142 - Avoid 100% CPU trying to get non-existant window. r=#thunderbird-reviewers

I think we can just remove this old workaround.
Nowdays we (normally) prompt for primary password before any window (security.prompt_for_master_password_on_startup).
That has its own issues (see bug 1882214).
But, even so, CalDAV requests do not seem to trigger before we have any window.

I'm unclear. Are you fixing the issue of this bug without changing the current default security.prompt_for_master_password_on_startup=true, and the problem of bug 1882214 remains?

Or are you changing the default to false?

Flags: needinfo?(mkmelin+mozilla)

I'm was just mentioning this for reference.
This patch just avoids (trying) to wait for a window, which was done to prevent rendering issues in PP dialog for non-window cases 11yrs ago.
The issues it does have at the moment on Mac are unchanged.

Flags: needinfo?(mkmelin+mozilla)
Target Milestone: --- → 126 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/0ba3ac5e8e7d
Avoid 100% CPU trying to get non-existant window. r=leftmostcat

Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED

This breaks calendar/test/browser/browser_calDAV_oAuth.js quite badly. I'll be backing it out at the next merge.

Got the wrong "this". I'll land a bustage-fix.

Pushed by mkmelin@iki.fi: https://hg.mozilla.org/comm-central/rev/374cc563e54b follow-up, fix wrong this. rs=bustage-fix DONTBUILD

(In reply to Magnus Melin [:mkmelin] from comment #7)

Got the wrong "this". I'll land a bustage-fix.

Hi, sorry for bothering you. Im not familiar with the language here, could you tell me if the issue is fixed in some current build or is it planned for future? I just tried thunderbird daily 126.0a1 (2024-04-09) and issue persisted. Is there a more granular build i can try?

Thanks in advance

(In reply to hirayasar from comment #9)

Hi, sorry for bothering you. Im not familiar with the language here, could you tell me if the issue is fixed in some current build ... I just tried thunderbird daily 126.0a1 (2024-04-09) and issue persisted. Is there a more granular build i can try?

Daily builds are created every morning from comm-central. So https://hg.mozilla.org/comm-central/rev/374cc563e54b would have been in daily build 20240411.

So perhaps file a new bug report with a new profile. Thanks.

The fix would be in daily 2024-04-11 and beyond. Note that dailies are disabled atm due to a crash issue.

(In reply to Magnus Melin [:mkmelin] from comment #11)

The fix would be in daily 2024-04-11 and beyond. Note that dailies are disabled atm due to a crash issue.

Thank you, ill try again in a couple days

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

Attachment

General

Created:
Updated:
Size: