Dev tools (and sometimes tab) freeze on React async infinite recursion
Reported by
a...@feezback.com,
Sep 19 2017
|
||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36
Steps to reproduce the problem:
Run attached file. Especially with DevTools open.
What is the expected behavior?
JS stuck, but being able to e.g. close tab.
What went wrong?
Can't close tab, sometimes can't pause with devtools or close them.
Did this work before? No
Chrome version: 60.0.3112.113 Channel: stable
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version:
This is the important code:
```
Application.prototype.componentWillMount = function componentWillMount() {
this.f();
};
Application.prototype.f = function f() {
var _this2 = this;
this.setState({ a: 1 }, function () {
return _this2.f();
});
};
```
It creates an async infinite recursion. Simpler async infinite recursion (with setTimeout()) doesn't exhibit this behavior, and the same code running as part of a larger project behaves worse, so I suspect it's at least somewhat performance-related.
,
Oct 2 2017
I cannot see what setState() does, but it looks like it'll create a promise to wrap the second param in. If this is the case it does what is expected. setTimeout({...}, 0) is not the same as Promise.resolve().then({...}). Since a promise is scheduled for the next microtask, where setTimeout({...}, 0) is just scheduled. This means before the javascript engine releases the context it will run whatever is in the mirotask queue causing infinite recursion.
I am going to mark this as wontfix since it is intended.
,
Oct 2 2017
Even if page freeze is expected, is dev tools freeze (not able to pause) or tab freeze (not able to close) expected? You shouldn't be able to DOS the browser from within js, I think. |
||
►
Sign in to add a comment |
||
Comment 1 by nyerramilli@chromium.org
, Sep 22 2017