Closed Bug 1724952 Opened 5 years ago Closed 1 year ago

Firefox causes excess WindowServer CPU usage

Categories

(Core :: Graphics: WebRender, defect)

Firefox 90
Unspecified
macOS
defect

Tracking

()

RESOLVED WORKSFORME
Performance Impact low

People

(Reporter: 6mjjmugn96, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf:resource-use)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:90.0) Gecko/20100101 Firefox/90.0

Steps to reproduce:

Seemingly any visual activity in a Firefox window will cause macOS's WindowServer process to consume excessive CPU time.

For example, I can have a window open to about:blank. WindowServer consumes about 40-50% CPU time. I just move my mouse pointer around inside the window and WindowServer spikes to around 170% CPU time. If I stop moving the pointer, it drops back down to baseline.

Or the throbber in a background tab can spin and WindowServer will spike.

Or any sort of "animation" on a displayed web page. But if that page isn't displayed, WindowServer's CPU time will drop back down.

This does not always happen. It appears that it takes several days of Firefox "uptime" for this to occur. It seems that WindowServer's baseline usage is increased when this problem is "active". Generally, restarting Firefox seems to fix the problem for a while, until it recurs.

I don't know how to consistently reproduce it. I'm happy to collect data, but I don't know what or how. This may or may not be related to #1679088.

This is under macOS 11.5.1.

Hi Bitt Faulk,

As it is also mentioned in Bug 1679088, please collect a performance profile using the profiler (https://profiler.firefox.com/) and don't forget to upload it using the upload button in the top-right corner. That link can be safely shared here. Thanks!

Component: Untriaged → Performance
Flags: needinfo?(6mjjmugn96)
Product: Firefox → Core

I set the Profiler to "Firefox Platform", opened an "about:blank", started the profiler, moved my mouse pointer into the window, did nothing for about 5s, then just moved the mouse pointer around inside the window for about 10s, then sat idle for about 5s, then stopped the profiler. During this time, top showed the firefox and WindowServer processes going from consuming about 15% and 25% CPU time, to about 70% and 125% CPU time during the mouse movement, then back down to 15%/25%. (There is definitely a lot of baseline variability, but the spike during mouse movement is large and unmistakable.)

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

Flags: needinfo?(6mjjmugn96)

Markus, maybe you could take a look here and see if anything jumps out? I'm unfamiliar with macOS WindowServer and I'm not sure what its expected/reasonable CPU usage is when stuff is actively painting (as it sounds like is typically the case here).

Flags: needinfo?(mstange.moz)

This is a legitimate bug but I'm not sure how to get a handle on it. If the WindowServer CPU usage gets worse over time, this must mean that we're somehow accumulating more work for the window server to do over time. For example, we might have more IOSurfaces or a bigger CoreAnimation layer tree. Or maybe the layer tree stays the same size but we're leaking something.

We did have similar reports about WindowServer CPU usage in other bugs, for example bug 1722722, but that particular one seemed to be fixed by a macOS update.

We've also fixed bug 1690687 recently, where we were unnecessarily sending messages to the WindowServer if nothing was changing on the screen, but that fix won't have helped when an actual animation is occurring.

There's also another open bug about growing memory that seems to be IOSurface-related on the surface, bug 1691136.

Flags: needinfo?(mstange.moz)
Status: UNCONFIRMED → NEW
Component: Performance → Graphics: WebRender
Ever confirmed: true
Whiteboard: [qf:p3:resource]
Blocks: wr-mac
OS: Unspecified → macOS

The severity field is not set for this bug.
:jimm, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(jmathies)
Severity: -- → S3
Flags: needinfo?(jmathies)
Performance Impact: --- → P3
Whiteboard: [qf:p3:resource]

This problem no longer exists from my point of view, as of Firefox 139.0.1 under MacOS 13.7.6. (It's been gone for quite a while, honestly. Years. I was just checking back through my bug reports and saw this was still open.)

Thanks!

Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.