Closed Bug 1556068 Opened 4 years ago Closed 4 years ago

Pasting big JSON into Console freezes content process

Categories

(DevTools :: Console, defect, P3)

defect

Tracking

(firefox69 fixed)

RESOLVED FIXED
Firefox 69
Tracking Status
firefox69 --- fixed

People

(Reporter: Harald, Assigned: nchevobbe)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

What were you doing?

  1. Open https://data.cityofnewyork.us/api/views/kku6-nxdu/rows.json?accessType=DOWNLOAD
  2. Paste raw JSON into Console
  3. Close DevTools

What happened?

Was able to close DevTools but the tab stayed unresponsive, it is now frozen for 5min and doesn't seem to recover.

Anything else we should know?

Profile: http://bit.ly/2W5cdo3

The content process is stuck in

analyzeInputString
js::RunScript
exports.makeInfallible/<
js::RunScript
autocomplete
bound
onPacket
receiveMessage
js::RunScript
MessageListener.receiveMessage
message manager handler
PBrowser::Msg_AsyncMessage
XRE_InitChildProcess
(root)

Okay, so I can see where this takes time. A first step might be to not try to autocomplete if the input is > to a given number of chars?

A first step might be to not try to autocomplete if the input is > to a given number of chars?

I thought about that too, makes for a good safeguard.

How sure are we that the issue here grows with character count vs hitting some recursive issue?

How sure are we that the issue here grows with character count vs hitting some recursive issue?

Yeah, the analyzeInputString function is one big for loop and doesn't use recursion.
From the profile, it looks like all the Array.from (and then Array.slice and Array.join) are responsible of the massive slowdown.

I'm trying to fix this by using something else.

Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED

It can happen that the string we receive is quite large
and as a result takes a long time to analyze, freezing
the process.
This patch simply tracks for how long the for loop is running,
and bail out if it's greater than a given time (set to 2500 ms
for now).
This is mostly a safeguard, a future patch should try to improve
the performance of the function itself.

Pushed by nchevobbe@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0a7fc2e413ad
Track JsPropertyProvider's analyzeInput string and bail if it's taking too long. r=Honza.
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 69
You need to log in before you can comment on or make changes to this bug.