Closed Bug 959363 Opened 11 years ago Closed 10 years ago

Multiple places threads using 100% of CPU when pasting long data urls in the locationbar

Categories

(Toolkit :: Places, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 907001

People

(Reporter: bzbarsky, Unassigned)

Details

(Whiteboard: [snappy] p=5)

Steps to reproduce:

1)  Load https://tbpl.mozilla.org/php/getParsedLog.php?id=32934905&tree=Mozilla-Inbound#error0 and https://tbpl.mozilla.org/php/getParsedLog.php?id=32745431&tree=Try#error0 and https://tbpl.mozilla.org/php/getParsedLog.php?id=32745486&tree=Try#error0 while those logs are still up.

2)  For each log scroll up one line to get to the data: URI for the screenshot.

3)  Paste those URIs into new tabs.

4)  Maybe close one of the tabs after pasting two URIs and then undo the close
    before pasting in the third URI?

EXPECTED RESULTS: Just load the images.

ACTUAL RESULTS: My fans started spinning like mad, CPU meter shows 200% CPU.  Profiling shows two threads both under mozilla::storage::Connection::stepStatement(sqlite3_stmt*), each taking a full core.  

In fact, the vast majority of the time under there is under mozilla::places::MatchAutoCompleteFunction::OnFunctionCall.  About half to 60% is the malloc() calls from copying the huge string in mozilla::storage::ArgValueArray::GetUTF8String.  About 20% is NS_IsAsciiWhitespace calls.  Most of the rest is self time in MatchAutoCompleteFunction::OnFunctionCall.

Not sure what all is going on here, but it's not very happy on my computer. Took about 10 mins to clear up...
I think there's another bug filed about a similar issue, the problem is very likely due to the fact we try to autocomplete using the data uri you pasted, that is clearly unwanted and should not happen. We should probably limit searches to a given threshold, there's not much gain into trying to complete a string that cannot even fit the autocomplete field.
Summary: Multiple places threads using 100% of CPU → Multiple places threads using 100% of CPU when pasting long data urls in the locationbar
Whiteboard: [snappy][triage]
Whiteboard: [snappy][triage] → [snappy]
Whiteboard: [snappy] → [snappy] p=0
No longer blocks: fxdesktopbacklog
Flags: firefox-backlog+
Whiteboard: [snappy] p=0 → [snappy] p=5
Marco, could you provide more information about where this change needs to be made?
Flags: needinfo?(mak77)
I found the bug I was speaking about in comment 1, this is basically a dupe of bug Bug 907001, that bug contains more information about what we should do.
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: needinfo?(mak77)
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.