Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when GCing modules reachable via multiple paths
Summary: Changelog: * **[Fix]**: Fix incremental build crashing when garbage collecting modules reachable via multiple paths in the graph. Under the GC algorithm implemented in D36403390 (9065257), the same white ( = marked for deletion) node may be reached multiple times during the "CollectRoots" phase - specifically, if it is the child of two or more white nodes. We had an overly strict null check that caused a crash in this case. In the test case added to `traverseDependencies-test`, the node that can be reached multiple times is `/baz`: ``` βββββββββββββββββββββββββββ β βΌ βββββββββββ / ββββββββ ββββββββ ββββββββ β /bundle β β/β· β /foo β βββΆ β /bar β βββΆ β /baz β βββββββββββ / ββββββββ ββββββββ ββββββββ β² β ββββββββββββββ ``` A real-world instance of this crash can be seen by launching the default React Native starter app (created with `npx react-native init MyApp`) and deleting the contents of `index.js`. This causes a crash when Metro attempts to collect the `node_modules/babel/runtime/helpers/interopRequireDefault.js` dependency multiple times. Reviewed By: huntie Differential Revision: D39416657 fbshipit-source-id: 084b3a0f6363ffc5f51f8cdabc1fc7e81616f4db
- Loading branch information