Unexpected infinite loop
Reported by
max.nord...@gmail.com,
Mar 5 2017
|
||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36
Steps to reproduce the problem:
1. Run `for(i = 0; i < setTimeout(() => {}); ++i) { clearTimeout(i); clearInterval(i) }` (works with function(){}` as well)
2. Write something in the console
3. Press enter
What is the expected behavior?
That the next expression is evaluated.
What went wrong?
Nothing happens in the console, but it had allocated 1.3Gb of memory and was running at 100% CPU before I killed it.
Did this work before? N/A
Chrome version: 55.0.2883.95 Channel: n/a
OS Version: OS X 10.12.3
Flash Version: Shockwave Flash 24.0 r0
Something in there obviously triggers an infinite loop, but it would be better if it stopped or at least didn't eat all my system resources.
,
Mar 6 2017
We currently don't provide protection for infinite loops. It's pretty easy to get yourself into one, including this clever snippet. :) We could look into pausing the debugger after we notice a console evaluation is taking X seconds, but I think it'd take us some time to add support for that. Going to wontfix for now as I don't think this is something we'll get to soon. Appreciate you reporting it and offering the idea, though!
,
Mar 6 2017
Yeah the general solution is a bit tricky, but I can't seem to figure out where the loop is here, especially since the evaluation finishes and the GUI remains responsive. As for pausing if it hasn't evaluated yet, what about stopping a runaway process? This is also true for faulty websites. So if you have 100% CPU and/or a large amount of memory allocated in a small time frame, then halt/pause/crash that process. Similar to synchronous execution blocking the main thread. Always happy to help :) |
||
►
Sign in to add a comment |
||
Comment 1 by nyerramilli@chromium.org
, Mar 6 2017