dillon1000/react
Commit
Browse files [Flight] Eagerly parse stack traces in DebugNode (#33589)
There's a memory leak in DebugNode where the `Error` objects that we instantiate retains their callstacks which can have Promises on them. In fact, it's very likely since the current callsite has the "resource" on it which is the Promise itself. If those Promises are retained then their `destroy` async hook is never fired which doesn't clean up our map which can contains the `Error` object. Creating a cycle that can't be cleaned up. This fix is just eagerly reifying and parsing the stacks. I totally expect this to be crazy slow since there's so many Promises that we end up not needing to visit otherwise. We'll need to optimize it somehow. Perhaps by being smarter about which ones we might need stacks for. However, at least it doesn't leak indefinitely.
Changed paths3 files
First-parent comparisonpackages/react-server/src/ReactFlightAsyncSequence.js ModifiedM packages/react-server/src/ReactFlightServer.js ModifiedM packages/react-server/src/ReactFlightServerConfigDebugNode.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…