Page MenuHomePhabricator

Firefox has high CPU utilization when scaled background images (particularly avatars) are visible
Closed, WontfixPublic

Description

You won't believe this, this is a crazy bug :-)

We have our own Phabricator instance. When I open certain Maniphest tickets, I see my CPU goes berserk - it eats 40% of my CPU constantly. Once I switch to a different tab, the CPU goes to almost zero utilization. For other tickets, though, the CPU is idle as well. Only some of them cause problems.

A colleague of mine sees a similar behavior (with 90% CPU utilization constantly), but for different tickets. I was very confused by this, and I've found the source of the problem after some debugging.

The CPU goes crazy if:

  1. the top bar (with your avatar icon) is displayed and
  2. there are other your avatar icons displayed on the page at the same time - e.g. you created the ticket, or (possibly, not tested) there are some comments from you on that page

If you scroll down the page a bit (so that the top bar is no longer visible), the CPU goes idle.
If you shrink the browser window so that no other your avatar images are visible (comments etc), the CPU goes idle.
If you use Firefox web development mode and remove either the top bar avatar image, or all other your avatar images on the page, the CPU goes idle.
If you log out (i.e. no avatar image displayed in the top bar) and see the same ticket again, the CPU goes idle.

Here's an example page that hogs the CPU for me (but not for my colleage):
https://phab.qadevel.cloud.fedoraproject.org/T181

Here's an example page that hogs the CPU for my colleage (but not for me):
https://phab.qadevel.cloud.fedoraproject.org/T162

Guys, do you have some crazy javascript image comparison code running there, or what? I'm not really proficient with javascript debugging, so I can't tell what exactly is causing it. But I can try to find out, if you tell me how.

I have verified this problem on several different machines running Fedora 20 and Firefox 29 (a clean profile tested as well), also several Phabricator user accounts. It does not happen with Epiphany (webkit-based). The version of our Phabricator is 20140518.git3a81f8c. I haven't seen the same problem with Differential tickets, just Maniphest ones.

Event Timeline

kparal raised the priority of this task from to High.
kparal updated the task description. (Show Details)
kparal added a project: Maniphest.
kparal added subscribers: kparal, tflink.

Great, it's happening here as well. For this very ticket, I see 20% CPU utilization as long as my avatar icons are visible simultaneously (the top bar, and the one next to "kparal created this task"). Once I scroll down a bit, the CPU utilization goes to nearly zero.

Please feel free to ping me on freenode (kparal on #fedora-qa), if you need some real-time response. Thanks!

Demo comment to try to reproduce the issue

The more avatar icons are displayed, the higher the CPU utilization seems to be (zooming out the page helps with that). I tried to use a completely fresh Firefox profile, single tab, and profile the javascript for several minutes, but its sampling method reveals nothing:

http://i.imgur.com/6hqFP8C.png

epriestley lowered the priority of this task from High to Normal.May 28 2014, 1:14 PM
epriestley added a subscriber: epriestley.

Filling in some context from IRC:

Offhand, we don't have any JS which seems likely to be causing this. We do run a Flash component to handle real-time notifications, which wouldn't appear on a JS profiler, but that doesn't interact with profile images.

It looks like this is probably the issue we're hitting, or at least very closely related to it, although we are not using background-size: cover.

https://bugzilla.mozilla.org/show_bug.cgi?id=846315

Particularly, @kparal confirmed on IRC that setting image.high_quality_downscaling.enabled to false in Firefox's about:config dropped CPU usage to more reasonable numbers.

Since other users are experiencing a similar issue in other software, and making a Firefox config adjustment fixes this, and it doesn't seem to reproduce in other browsers, this looks like a Firefox bug. We might be able to find a workaround until it gets fixed, although using background-size is important to accommodate high-DPI displays like newer iPhones.

This comment was removed by kparal.
epriestley renamed this task from CPU looping in Web UI related to user avatar image to Firefox has high CPU utilization when scaled background images (particularly avatars) are visible.May 28 2014, 1:33 PM

This has just been fixed in Firefox master branch. It will take some time until it's part of the stable release.

epriestley claimed this task.

We're unlikely to get to it before Firefox releases, especially since we don't seem to have a straightforward technical approach available.

The fix is now a part of the Firefox stable release (Firefox 35). The problem seems to be gone.