Open Bug 964815 Opened 11 years ago Updated 2 years ago

Firefox hangs for long time when opening box.com document (thousands of <use> elements)

Categories

(Core :: SVG, defect)

defect

Tracking

()

Tracking Status
firefox28 - affected
firefox29 --- affected
firefox30 --- affected

People

(Reporter: yury, Unassigned)

References

(Depends on 1 open bug)

Details

(Keywords: perf)

Attachments

(2 files)

Opening https://app.box.com/s/euscsfh0h9pgbeqq57g4 causes FF not to respond for some time. CPU spikes to 100%.
Attached file reduced test case
Component: Untriaged → SVG
Product: Firefox → Core
The document seems to consist of 4.5 MB of <use> elements. It hangs Opera 12 too.
OS: Mac OS X → All
Hardware: x86 → All
I guess firefox 29 and 30 are also affected?
Can we find out how far back this reproduces? That might help also determine if this is a bug on the Firefox side or something with the web content.
I don't think it a regression, the SVG that is generated by conversion of PDF content. The content contains lots of elements as mentioned in comment 2. I think all browsers will have issue with this SVG - it might take long time to render it, but we shall not lock the main thread because of it.
Regression window(m-c) Good: http://hg.mozilla.org/mozilla-central/rev/b370698fb55c Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a1) Gecko/20110521 Firefox/6.0a1 ID:20110521173635 Bad: http://hg.mozilla.org/mozilla-central/rev/76f08a32c046 Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0a1) Gecko/20110521 Firefox/6.0a1 ID:20110521181806 Pushlog: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=b370698fb55c&tochange=76f08a32c046 Triggered by: Bug 308590
Without bug 308590 we ignore the use elements so it's not really a regression as the testcase data is mostly ignored prior to that bug.
no longer tracking based on comment 8 stating this is not a regression and this being in product for a long time.
Depends on: 869505
Keywords: regressionperf
Summary: Firefox is unresponsive for long time when opening box.com document → Firefox hangs for long time when opening box.com document (thousands of <use> elements)

Yury, the file https://app.box.com/s/euscsfh0h9pgbeqq57g4 cannot be accessed anymore, can you please confirm if this bug eventually got resolved or is still valid? I'm trying to identify performance bugs that would impact Enterprise users.

Flags: needinfo?(ydelendik)

(In reply to Romain Testard [:RT] from comment #11)

Yury, the file https://app.box.com/s/euscsfh0h9pgbeqq57g4 cannot be accessed anymore, can you please confirm if this bug eventually got resolved or is still valid? I'm trying to identify performance bugs that would impact Enterprise users.

The link came from somewhere else. I reduced the referenced document into the test case I attached. Fixing the test case performance will fix the original document.

Flags: needinfo?(ydelendik)

Chrome takes quite a while to finish rendering the attached testcase, too, though it finishes loading in less than a minute, whereas my Firefox tab has the throbber bouncing forever, it seems.

The testcase itself is a giant <img src="data:image/svg+xml,..."> element, with ~4.5mb of SVG data (which is largely composed of 37463 <use> elements that are referencing #Image_7_2_TK7m2L, which is this 5x5 <image>:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAMAAAC6sdbXAAADAFBMVEX////8/Pz6+vr09PTy8vLv7+/r6+sKCgoHBwcDAwMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC8Dz8/AAAARElEQVR42mJgYOFk4AIAAAD//2JgY2DlYgAAAAD//2JgYGJgYAEAAAD//2Jg5GJmYAAAAAD//2JgZ+JgYwYAAAD//wMABWYAW1DwJzIAAAAASUVORK5CYII=

Here's a profile from when I loaded the page: https://perfht.ml/3b8sWig

It looks like there's some initial load work, and then a long time spent in mozilla::image::ProgressTracker::OnUnlockedDraw (which spends quite a while in ImageIsAnimated for some reason -- as far as I can tell, the image here is not animated, but apparently there's enough overhead in determining that for this to show up in the backtrace).

The testcase itself is a giant <img src="data:image/svg+xml,..."> element

Here's the SVG document as a standalone file. (I've replaced >< with >[newline]< throughout the file, for readability's sake. Beyond that, it's the direct data URI from the original reduced testcase here.)

Note that we render the standalone SVG document pretty quickly (in < 10 seconds on my machine) -- significantly faster than Chrome does, in fact.

For the <img> version, I'm guessing that it hits some SVG-as-an-image notification death-spiral, with e.g. each <image>-load triggering a full repaint of the <img> or something like that. (I don't know that it's exactly that, but something like that probably).

Note also that the attached testcase seems to have been generated by "crocodoc" (as can be seen via various crocodoc-themed class-names in the SVG file).

This is a tool that was acquired in 2013 by Box:
https://techcrunch.com/2013/05/09/box-acquires-crocodoc-to-add-html5-document-converter-and-sleek-content-experience-to-cloud-storage-platform/

However, it seems that Box EOL'ed this tool in Jan 2018 (replacing it with "new box view", whatever that is). References:
(1) "Blackboard’s current inline grading tool Crocodoc will reach its end-of-life date on January 15, 2018."
https://umaine.edu/citl/transitioning-crocodoc-new-box-view-blackboard/
(2) @crocodoc twitter account tweeted a crying crocodile with caption "After a while, crocodile" on Jan 16 2018
https://twitter.com/Crocodoc/status/953378523086860288

So it appears this particular document-generation-tool is no longer in use on Box, for what it's worth. Hopefully that means Box users aren't actually running up against this at this point.

FWIW, the reduced testcase.html got massively improved by bug 1753453. The testcase loads in 6-8 seconds for me now.

Bug 1753453 - Don't send OnUnlockedDraw for non-animated images. r=aosmond

We're checking animation consumers, not locked status. We don't care
about animation consumer count of non-animated images.

Depends on D137765

Differential Revision: https://phabricator.services.mozilla.com/D137766

Depends on: 1753453
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: