Open Bug 1186116 Opened 11 years ago Updated 3 years ago

Hang in JS, with steadily-increasing memory usage, when viewing a particular jsbin

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

Tracking Status
firefox42 --- affected

People

(Reporter: dholbert, Unassigned)

References

(Depends on 1 open bug, )

Details

Attachments

(1 file)

STR: (warning: this may hang your browser) 1. Visit http://jsbin.com/qeweyi/8/edit?html,output 2. Inspect your browser & its CPU/memory usage, e.g. via top ACTUAL RESULTS: - Browser (or web-content process if you're using e10s) becomes unresponsive. - "top" shows that CPU usage is 100% and memory usage is steadily increasing. (I've killed it when it hits 25-30% of my memory, to avoid destabilizing my system.)
Crash reports, from killing the hanging process (i.e. this is where we're hanging): bp-00de66e4-acc5-417f-92ed-f15522150721 js::jit::SetEnterJitData(JSContext*, js::jit::EnterJitData&, js::RunState&, JS::AutoVectorRooter<T>&) bp-921cb7f8-07a1-4337-9d8e-afd922150721 js::GCMarker::drainMarkStack(js::SliceBudget&) bp-e14dd360-e5ae-4a5f-9b15-2c6532150721 void js::GCMarker::markAndPush<T>(js::GCMarker::StackTag, js::ObjectGroup*)
(In reply to Daniel Holbert [:dholbert] from comment #1) > Crash reports, from killing the hanging process (i.e. this is where we're > hanging): (Or rather: this is where we happen to be at a particular instant, while the process is hanging)
Flags: needinfo?(jdemooij)
Attached file Reduced test —
If I open this HTML file, about 50% of the time I don't get the slow script dialog to appear.
When I open the HTML file I attached, it often "hangs" without showing the slow script dialog. The JS engine correctly calls the interrupt callback, which calls nsGlobalWindow::ShowSlowScriptDialog. There everything is fine until we do: rv = prompt->ConfirmEx(title, msg, buttonFlags, waitButton, stopButton, debugButton, neverShowDlg, &neverShowDlgChk, &buttonPressed); This call doesn't seem to return or show the dialog, I don't know why. This is on OS X without e10s. Sometimes it does show the slow script dialog, so you may have to try a few times.
Component: JavaScript Engine → DOM
Flags: needinfo?(jdemooij)
smaug, do you know who can look at this? A broken slow script dialog is pretty bad for the user, they have to kill the browser..
Flags: needinfo?(bugs)
Let me try to reproduce and capture the stack. Maybe that rings some bells.
(my initial guess is that we're close to recursion limit and can't really run the JS which the confirm dialog needs.)
jandem, any idea why we're hanging with the testcase? We seem to be all in JS code, and I don't understand what causes the hang. Also, I'm not getting nsGlobalWindow::ShowSlowScriptDialog call.
Flags: needinfo?(jdemooij)
Oops, my testing profile had dom.max_script_run_time=0
Ok, I can reproduce the not-showing-the-dialog issue always. My current guess is that while we're about to show the dialog, another timer from the page runs and we hang again. I'll file another bug for that, since this bug is about hanging. Why other browsers don't spent tons of time in JS in this case?
Flags: needinfo?(bugs)
But Bug 1191004 isn't enough to fix the issue related to the dialog handling.
oh, this is fun. The issue is basically that we need to spin event loop while showing the dialog and anything the page might do async might get run.
And if we end up executing page's script while trying to show the slow-script dialog, we don't seem to get another call to ShowSlowScriptDialog.
(In reply to Olli Pettay [:smaug] (vacation Aug 11 - Aug 18) from comment #10) > I'll file another bug for that, since this bug is about hanging. Why other > browsers don't spent tons of time in JS in this case? It uses ES6 generators, most other browsers don't support this yet. The Q library also uses some browser specific stuff/hacks like our legacy generators.
Flags: needinfo?(jdemooij)
> And if we end up executing page's script while trying to show the slow-script dialog, we > don't seem to get another call to ShowSlowScriptDialog. Yeah, I think the JS engine tries to prevent what it considers reentry there... One possibly-viable option would be to just treat such a reentry attempt the same way we treat the user selecting "stop script": throw an uncatchable exception, instead of treating it like "continue". Also, we should consider suspending timers on the page like we would for a sync XHR...
Component: DOM → DOM: Core & HTML
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: