-
Notifications
You must be signed in to change notification settings - Fork 16
Clear child modules on dispose. #139
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
Clear child modules on dispose. #139
Conversation
cuz we gotta clear all references
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
Codecov Report
@@ Coverage Diff @@
## master #139 +/- ##
==========================================
- Coverage 96.82% 96.55% -0.27%
==========================================
Files 4 4
Lines 346 348 +2
==========================================
+ Hits 335 336 +1
- Misses 11 12 +1
Continue to review full report at Codecov.
|
lib/src/lifecycle_module.dart
Outdated
return; | ||
} | ||
|
||
_childModules.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a test for this. I think the easiest way to do that would be to insert a tearDown
step right here:
https://github.com/Workiva/w_module/blob/master/test/lifecycle_module_test.dart#L1502
tearDown(() {
if (withChild) {
expect(module.childModules, isEmpty);
}
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected to see this right after line 888 where we are disposing of the child modules. It seems like you guys have found a bug that is preventing us from hitting line 888 where we dispose of the child modules--is anyone trying to figure out why that's not getting hit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hold on this; this might be a good change, but we might have isolated our problem to a different location. |
We remove child modules on disposal of the child module. I would suggest that we remove child modules on the unload of the child module as well. w_module/lib/src/lifecycle_module.dart Line 518 in f8b3602
|
Do this using existing methods made specifically for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one memory-related comment.
so we don't miss anything before our disposal.
@joshprzybyszewski-wf @jacobjohnson-wf would you guys be able to use this branch to verify that it fixes the memory leaks you were seeing? That would serve as a good QA for this PR |
^ nevermind, looking at the DT PR again, it looks like the leak would be addressed without this PR anyway, so it's not a great candidate for QA here. |
QA +1 @Workiva/release-management-pp |
Problem
We're seeing modules get leaking text_doc_client.
Solution
We think that clearing the list of modules is a fail-safe solution to ensure that we don't retain references to children modules when we've been disposed.
@jacobjohnson-wf @evanweible-wf @bencampbell-wf