CPUUsage b38.085 firefox.exe!xul.dll!nsCSSBorderRenderer::DrawBorderSidesCompositeColors

RESOLVED DUPLICATE of bug 1269351

Status

()

--
critical
RESOLVED DUPLICATE of bug 1269351
3 years ago
3 years ago

People

(Reporter: abbGZcvu_bugzilla.mozilla.org, Unassigned)

Tracking

({hang, testcase})

46 Branch
hang, testcase
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

3 years ago
Created attachment 8753246 [details]
repro.html

Repro:

<progress style=border-left-width:999999999em>

Causes excessive CPU usage in nsCSSBorderRenderer::DrawBorderSidesCompositeColors:
https://mxr.mozilla.org/mozilla-central/source/layout/base/nsCSSRenderingBorders.cpp#723

697   for (uint32_t i = 0; i < uint32_t(maxBorderWidth); i++) {
... lots of computations here...
726   }

maxBorderWidth is controlled through the CSS style. The repro provides a high value that makes this loop take a very long time to complete.

Even if the code inside the loop could be optimized, simply counting up to the highest possible unsigned integer would consume excessive CPU and take a long time.

Possible solutions: a sane limit to the number of loops could be applied, but since the time spent running this loop relies on both the number of loops and the time it takes to complete one loop (which depends on the speed of the machine it is running on), measuring the time spend in the loop and terminating it after a set amount would be a better, but more (if not overly) complex solution.
(Reporter)

Comment 1

3 years ago
Created attachment 8753249 [details]
BugId report

BugId (https://github.com/SkyLined/BugId) can now detect excessive CPU usage, determine which function is causing it and provide a unique id for the instance.
(Reporter)

Updated

3 years ago
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1269351
You need to log in before you can comment on or make changes to this bug.