-
Notifications
You must be signed in to change notification settings - Fork 45.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in ReactDOMInput on server rendering #4870
Comments
The difference appears to be that in 0.13, adding the node to componentDidMount: function() {
var id = ReactMount.getID(this.getDOMNode());
console.log('mounting', id);
instancesByReactID[id] = this;
},
componentWillUnmount: function() {
var rootNode = this.getDOMNode();
var id = ReactMount.getID(rootNode);
console.log('unmounting', id);
delete instancesByReactID[id];
}, So my console is quiet when running the app with these log statements. |
cc @spicyj |
@zpao Is there a plan for this, or do you have some pointers for how the team wants to handle server rendering architecturally so mount code like this doesn't fire? Happy to do a PR, this is definitely a 0.14 blocker. Our testnet servers crash every 8hrs because of this. |
I haven't decided how best to fix this. You can see I already marked it for the 0.14 milestone though. |
Fixes facebook#4870. This more or less matches what we were doing with the old wrapper components (not storing until componentDidMount).
Don't store <input> instance until mount-ready
So facebook#4976 was a lie. Fixes facebook#4870 for real (thanks @STRML).
So facebook#4976 was a lie. Fixes facebook#4870 for real (thanks @STRML).
Actually don't store <input> until mount-ready
👍 Thanks! |
In React 0.14.0-rc1 I've seen a massive memory leak as it appears my entire app is being retained.
After some time in the profiler, I narrowed it down to ReactDOMInput's
instancesByReactID
(I have a radio input in my app):Removing
instancesByReactID
entirely in the source fixes the leak.To diagnose this, I added some log statements:
Then ran the app:
Notice that the unmount never logs, so these instances stay in
instancesByReactID
forever.I am simply rendering using
ReactDOMServer.renderToString()
.The text was updated successfully, but these errors were encountered: