New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 630840 link

Starred by 5 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug



Sign in to add a comment

Infinite javascript loop should not prevent from reloading the page

Reported by teo8...@gmail.com, Jul 23 2016

Issue description

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36

Steps to reproduce the problem:
1. visit http://output.jsbin.com/hacolup
2. click the button that says "Start infinite loop"
This will start a while(true) loop

3. try to click on the Reload button or the Home button

What is the expected behavior?
When clicking on the Reload button, the running script should be stopped, and the page should be reloaded.
Similarly, when clicking on the home button, the running script should be stopped and the home page should be loaded

What went wrong?
When clicking on the Reload button, the infinite loop keep running and consuming 100% CPU and prevents the page from reloading.
The same happens when you click on the home button. You may get to see the url of the home page on the address bar (which is even worse as it is inconsistent) but the page doesn't even start to load because the browser is stuck running the infinite loop initiated by the script in the page

Did this work before? No 

Chrome version: 51.0.2704.106  Channel: n/a
OS Version: 
Flash Version: Shockwave Flash 22.0 r0

Any action initiated from the USER INTERFACE of the browser outside the contents of the page should prevail over whatever is happening inside the page.

I understand that there might be events that must be honoured before the page is unloaded or something, so you cannot just always interrupt the script no matter what, but then at least you should show a popup with something like "A script in the page is not responding. Would you like to stop it?"

Also, if you can close the tab (which actually stops the script), then there's no reason you shouldn't be able to reload or navigate away to the home page.
 
Components: -Blink Blink>Loader
Cc: durga.behera@chromium.org
Labels: Needs-Feedback
Thanks for the report, could you please review the screen cast tried on Ubuntu 14.04 using latest stable 52.0.2743.82.
When clicked on refresh/reload button the unresponsive pop-up was seen to provide user's action and while clicked on Home button the home page is displayed(New tab here in this case).
630840_July_25.ogv
2.0 MB View Download
Just to drag another platform into the equation, this is present on 53.0.2785.34 beta on Mac OS X 10.11.5. The home button operates correctly, but there is no unresponsive pop-up despite the reload button hanging.
The bug still exists in M53. The bottom line is that the JavaScript thread kills an entire CPU and the tab's UI becomes unresponsive.

I've filed a separate issue reproducing it, along with additional buggy behavior -  issue 653783 .

Comment 5 by kouhei@chromium.org, Apr 12 2017

Cc: toyoshim@chromium.org clamy@chromium.org
Components: UI>Browser>Navigation
Labels: -Pri-2 Pri-3
Status: Available (was: Unconfirmed)
+nav

Components: Blink>JavaScript>API
I think this is not navigation specific problem, e.g. we could not even close the tab on infinite JS loop unfortunately. Maybe v8 specialist would have an idea how to fix this problem?

Comment 7 by creis@chromium.org, Apr 13 2017

Owner: a...@chromium.org
Comment 6: There's an unresponsiveness timer that is supposed to ensure you can close the tab or navigate away from the page, at least to cross-site pages that lead to a new renderer process.  (Note that this timer is disabled when DevTools is open.)

There's no way to "stop the script" in Chrome, so the current renderer process is unusable until you either kill it via the unresponsiveness dialog, navigate to a different process, or close the tab.

Avi, can you check whether this page has found a problem with the timer, since you've refactored it recently?  I would expect tab closing and cross-process navigations to work.

Comment 8 by creis@chromium.org, Apr 13 2017

Cc: creis@chromium.org
Status: Assigned (was: Available)
> Note that this timer is disabled when DevTools is open.
Oops... probably when web developers mistakenly write infinite loop in JS, they would have the DevTools open. But probably there is a technical reason to need to disable it for DevTools?

I didn't know that fact. The unresponsiveness timer should still work correctly. I confirmed that the reported page can be closed immediately if DevTools is closed.

Comment 10 by a...@chromium.org, Apr 13 2017

Summary: Infinite javascript loop should not prevent from reloading the page (was: Infinite javascript loop should not prevent from reloading the page or navigating away)
I think is separate from the devtools issue.

Navigating via the home button works immediately, as do the forward and back arrows. The reload button, though, hangs.

That's wrong. If navigating with the arrows or home navigate immediately (which they should), so should the reload button.

Comment 11 by creis@chromium.org, Apr 13 2017

Comment 9: The DevTools issue is being tracked in  issue 684202 .

Comment 10: Reload would use the same SiteInstance and stay in the same process, which is already hung.  The hang dialog will eventually show up in that case.

You could imagine making the hung renderer dialog show up 1 second after clicking reload if the renderer doesn't respond?  I don't think you'd want to automatically kill the process and restart it, since it could just be temporarily slow and have other tabs in it.

Comment 12 by a...@chromium.org, Apr 13 2017

That's a pretty nice proposed solution.

Sign in to add a comment