-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX lts] Ensure instantiation cannot happen after destruction.
This changes a bit about how destruction occurs and is enforced. Without these changes, it is possible to introduce memory leaks in FastBoot in a few (somewhat specialized) scenarios. Some examples: * if you were to call `owner.lookup` sometime after the owner itself was destroyed. During development and tests we prevent this (by way of an assertion), but in production we happily recreate the instances (without marking them as `isDestroying`) and never destroy them * if you were to call `owner.lookup` _during_ destruction (e.g. in another services `willDestroy`) we would emit no warning / assertion even in development mode, and we would never destroy the instances created In order to prevent these situations, this commit introduces these changes: 1. ensure that looking things up from the container _during_ destruction emits a deprecation 2. ensure that looking things up from the container _after_ destruction throws an error (**not** an assertion) 3. ensure that any objects that _are_ instantiated during container destruction (even though deprecated) will themselves be destroyed (cherry picked from commit 298a086)
- Loading branch information
Showing
2 changed files
with
136 additions
and
17 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