Last Comment Bug 323028 - [FIX]Using background-image CSS style for treechildren::-moz-tree-row causes excessive CPU load
: [FIX]Using background-image CSS style for treechildren::-moz-tree-row causes ...
Status: RESOLVED FIXED
[rft-dl]
: fixed1.8.1, regression, testcase, verified1.8.0.2
Product: Core
Classification: Components
Component: XUL (show other bugs)
: Trunk
: All All
: P1 normal (vote)
: mozilla1.9alpha1
Assigned To: Boris Zbarsky [:bz]
:
Mentors:
Depends on:
Blocks: 259139
  Show dependency treegraph
 
Reported: 2006-01-11 02:49 PST by Matthew Gertner
Modified: 2008-07-31 03:20 PDT (History)
5 users (show)
martijn.martijn: blocking1.8.1?
dveditz: blocking1.8.0.2+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Example of a stylesheet that causes the problem. (1.12 KB, text/plain)
2006-01-11 03:03 PST, Matthew Gertner
no flags Details
XUL file that uses the CSS (3.27 KB, text/plain)
2006-01-23 11:27 PST, Matthew Gertner
no flags Details
Improved XUL example (983 bytes, text/plain)
2006-01-24 02:02 PST, Matthew Gertner
no flags Details
Stylesheet pointing at actual image (1.03 KB, text/css)
2006-01-24 08:31 PST, Boris Zbarsky [:bz]
no flags Details
XUL pointing to that CSS (961 bytes, application/vnd.mozilla.xul+xml)
2006-01-24 08:32 PST, Boris Zbarsky [:bz]
no flags Details
New stylesheet referencing original images (340 bytes, text/css)
2006-01-25 08:05 PST, Matthew Gertner
no flags Details
XUL file using new stylesheet (871 bytes, application/vnd.mozilla.xul+xml)
2006-01-25 08:06 PST, Matthew Gertner
no flags Details
Patch to fix (1.22 KB, patch)
2006-01-26 08:51 PST, Boris Zbarsky [:bz]
dbaron: review+
dbaron: superreview+
Details | Diff | Splinter Review
Updated to comments (1.07 KB, patch)
2006-01-26 17:10 PST, Boris Zbarsky [:bz]
dbaron: approval‑branch‑1.8.1+
dveditz: approval1.8.0.2+
Details | Diff | Splinter Review

Description Matthew Gertner 2006-01-11 02:49:42 PST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

We are using PNG images as background for a XUL tree using the background-image style attached to treechildren::-moz-tree-row. When the tree is visible, CPU usage immediately goes to 100%. I don't think that the specific images are the problem since I tried converting them to GIFs, changing the size, etc. and the problem persists.

Reproducible: Always
Comment 1 Matthew Gertner 2006-01-11 02:56:46 PST
I just noticed that the problem only occurs when properties are specified for the tree row using treechildren::-moz-tree-row(X, Y, ...).
Comment 2 Matthew Gertner 2006-01-11 03:03:19 PST
Created attachment 208192 [details]
Example of a stylesheet that causes the problem.
Comment 3 Matthew Gertner 2006-01-23 11:27:36 PST
Created attachment 209374 [details]
XUL file that uses the CSS

This is the XUL file associated with the CSS. The important part is the vbox with id="apPeerTreeBox".
Comment 4 Boris Zbarsky [:bz] 2006-01-23 19:35:18 PST
So.. I linked to that CSS file from that XUL, changed the images in the CSS file to https://www.mozilla.org/images/header_logo.gif and there was no CPU usage at all.  I suspect at least part of this is that there are no treerows in that XUL... What's a XUL file that actually _does_ show the problem?  
Comment 5 Matthew Gertner 2006-01-24 02:02:03 PST
Created attachment 209433 [details]
Improved XUL example

Here's a new XUL file that reproduces the bug without the need for additional JavaScript. Obviously the path to the CSS must be tweaked. The problem is definitely linked to the properties of the tree rows. If I set properties for just one row, there is no problem. If I set "checked leaf" for both there is also no problem. It is only when I set one to "checked leaf" and the other to "unchecked leaf" that the process goes to 100%.
Comment 6 Boris Zbarsky [:bz] 2006-01-24 08:31:12 PST
Created attachment 209449 [details]
Stylesheet pointing at actual image
Comment 7 Boris Zbarsky [:bz] 2006-01-24 08:32:59 PST
Created attachment 209450 [details]
XUL pointing to that CSS

Matthew, with this testcase (which points to the CSS, which points to the bugzilla image), I see zero CPU usage in a current trunk seamonkey build.  Do you see the CPU problem with it in a trunk build?
Comment 8 Boris Zbarsky [:bz] 2006-01-24 08:35:22 PST
I also see zero CPU usage in Firefox 1.0.7 (release build) and Firefox 1.5.0.1 release candidate (debug build).

All of this on Linux.  Is this a Windows-only issue?
Comment 9 Matthew Gertner 2006-01-24 08:46:41 PST
If you aren't seeing the symptoms under Linux, it's very possible this is a Windows-only issue. I've only tested on Windows with the 1.8 branch.
Comment 10 Boris Zbarsky [:bz] 2006-01-24 08:52:09 PST
But you do see the problem when loading from bugzilla the XUL file I attached?
Comment 11 Matthew Gertner 2006-01-24 09:14:43 PST
Yes, but only when I select the first row in the tree. Not sure what's going on since I didn't need to do that in the original example, but I assume it's the same problem and this should enable you to reproduce it.
Comment 12 Boris Zbarsky [:bz] 2006-01-24 09:37:37 PST
Hmm.... That worksforme too.  :(

Do you have a build with symbols you could test in a debugger, by chance?  If so, just breaking randomly and seeing where you are in the code would help...
Comment 13 Martijn Wargers [:mwargers] (not working for Mozilla) 2006-01-24 12:52:14 PST
Fwiw, this is worksforme with current trunk build on WindowsXP.
Comment 14 Matthew Gertner 2006-01-25 08:05:46 PST
Created attachment 209585 [details]
New stylesheet referencing original images

I think the problem may be somehow linked to the actual images we are using, so I'm uploading a new stylesheet that references them instead of the images used by Boris.
Comment 15 Matthew Gertner 2006-01-25 08:06:44 PST
Created attachment 209586 [details]
XUL file using new stylesheet
Comment 16 Matthew Gertner 2006-01-25 08:10:17 PST
Try the latest XUL file. I get the problem on both my official release and debug version of FF 1.5 on Windows XP (CPU immediately goes to 100%).
Comment 17 Martijn Wargers [:mwargers] (not working for Mozilla) 2006-01-26 07:25:57 PST
With the latest XUL file, I can see the 100% cpu.
I've made a modified testcase here (I can't seem to use data uri inside ::-moz-tree-row selector?):
http://wargers.org/mozilla/bug323028/323028_excessive_cpu.xul
Here I have a backtrace with a breakpoint in nsTreeSelection::InvalidateSelection:
http://wargers.org/mozilla/bug323028/bt_323028.txt
This regressed between 2004-09-20 and 2004-09-21:
http://bonsai.mozilla.org/cvsquery.cgi?treeid=default&module=all&branch=HEAD&branchtype=match&dir=&file=&filetype=match&who=&whotype=match&sortby=Date&hours=2&date=explicit&mindate=2004-09-20+06%3A00%3A00&maxdate=2004-09-21+10%3A00%3A00&cvsroot=%2Fcvsroot
Comment 18 Boris Zbarsky [:bz] 2006-01-26 08:37:15 PST
This is a regression from bug 259139
Comment 19 Boris Zbarsky [:bz] 2006-01-26 08:51:17 PST
Created attachment 209711 [details] [diff] [review]
Patch to fix
Comment 20 David Baron :dbaron: ⌚️UTC+1 (mostly busy through August 4; review requests must explain patch) 2006-01-26 10:01:31 PST
Comment on attachment 209711 [details] [diff] [review]
Patch to fix

Replace "return" with "return rv" and r+sr=dbaron.
Comment 21 Boris Zbarsky [:bz] 2006-01-26 17:10:12 PST
Created attachment 209781 [details] [diff] [review]
Updated to comments
Comment 22 Boris Zbarsky [:bz] 2006-01-26 19:07:44 PST
Fixed.
Comment 23 Boris Zbarsky [:bz] 2006-01-26 19:07:58 PST
Comment on attachment 209781 [details] [diff] [review]
Updated to comments

I think this is worth it for the 1.8 branch.
Comment 24 Boris Zbarsky [:bz] 2006-01-31 22:14:27 PST
Comment on attachment 209781 [details] [diff] [review]
Updated to comments

It's likely worth it to take this on the 1.8.0 branch too.  This is a very safe fix that just reverts to the behavior this code had in 1.7.
Comment 25 Boris Zbarsky [:bz] 2006-02-01 11:24:54 PST
Fixed on 1.8.1 branch.
Comment 26 Daniel Veditz [:dveditz] 2006-02-22 00:29:09 PST
Comment on attachment 209781 [details] [diff] [review]
Updated to comments

approved for 1.8.0 branch, a=dveditz
Comment 27 Boris Zbarsky [:bz] 2006-02-22 18:46:58 PST
Fixed for 1.8.0.2.
Comment 28 Dave Liebreich [:davel] 2006-03-01 16:22:20 PST
Marking [rft-dl] (ready for testing in Firefox 1.5.0.2 release candidates)
Comment 29 Jay Patel [:jay] 2006-03-08 16:45:42 PST
v.fixed on 1.8.0 branch with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2, cpu usage normal with latest xul testcase.

Note You need to log in before you can comment on or make changes to this bug.