James Simpson
James Simpson

Reputation: 13688

How to debug unresponsive page in Google Chrome?

I've got a fairly complex javascript application (it uses no external frameworks) that users are currently testing (a couple thousand lines). I've been getting reports that users are getting the popup in Google Chrome saying:

The following page(s) have become unresponsive. You can wait for them to become responsive or kill them.

They report that the only way to keep using the app is to open a new Chrome window, but that the messages comes back up every few minutes, and only happens when they try to go to a new page. They specifically said that they click to go to a new page, and the current page never changes, they just see the spinning loading icon for a minute until the popup comes sup.

The odd thing is that I've tested extensively on the exact version of Chrome (18) that these users are having issues with, and I've seen no problems. I'm sort of stumped and don't know where to look now since I've been unable to duplicate it, any ideas on where to look next to at least try and figure out what could even be causing that error?

Upvotes: 29

Views: 66796

Answers (3)

tgrrr
tgrrr

Reputation: 1279

I had a page today that had some buggy JS (infinite loop) and I couldn't open the dev tools via keyboard shortcut or right click (Chrome 60.0.3112.113). Was able to get past this by:

  1. Open new tab
  2. Open dev tools (on empty tab)
  3. Enter URL and load
  4. Pause JS execution in dev tools

Maybe this will help someone! Also chrome debugger persists breakpoints across browser tabs (for same JS) so if I wasn't able to determine exactly what was causing the error, my breakpoints would still be there in a new tab!

Upvotes: 4

Jared
Jared

Reputation: 3176

I know this is an old question but I had this problem as well, and my best recommendation to you is the following:

Close Chrome completely and then add " --enable-logging" to your chrome shortcut to start it with that flag, you can even add " --enable-logging --v=1" to enable verbose logging.

I know with me, inserting a breakpoint wasn't an option because it was in a new tab that crashed before I could even get the console up. However, by enabling logging, the console gets written to a file in your chrome data directory ("C:\Users\username\AppData\Local\Google\Chrome\User Data")

I hope this helps somebody someday like it did me! :D

Upvotes: 22

Colin Godsey
Colin Godsey

Reputation: 1321

Use the chrome javascript debugger to pause (breaks running code) during the unresponsiveness. It takes some timing, but it should break in the middle of whatever is running too long. You can then use the debugger controls to step around and see what is looping unnecessarily.

Upvotes: 20

Related Questions