-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GC bug causing Fast Refresh to break on cycles with async deps
Summary: Fix a bug in Metro's delta traversal, where a garbage cycle with an async or weak dependency would throw and fail the traversal. This was due to the incorrect assumption that each of a `Module`'s `dependencies` was a reference to another node in the graph. In fact, weak and async+lazy dependencies are not counted references for GC purposes ("children" in [Bacon & Rajan](https://pages.cs.wisc.edu/~cymen/misc/interests/Bacon01Concurrent.pdf)), and have no corresponding entry in `inverseDependencies`. This would throw on `nullthrows(this.dependencies.get(dependency.absolutePath))`, which is caught upstream as a traversal error. This would leave the Fast Refresh in a broken state, with the delta effectively lost, and also leave partially collected cycles in graph's internal state. Instead, we iterate over only those dependencies with a corresponding inverse. Changelog: ``` **[Fix]:** Fast Refresh breaks on encountering a garbage cycle with async/weak dependencies. ``` Reviewed By: motiz88 Differential Revision: D51667736 fbshipit-source-id: ab6191c1ed6cc5f454200a5eb12a4514ce4e6b70
- Loading branch information
1 parent
5105171
commit e223a2e
Showing
2 changed files
with
154 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters