Add sleep to allow background threads to quiesce #5933
Merged
+23
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
One of the inproc tests is failing because the module is not unloaded (nor are any of the statics destroyed) after the attempt to unload it through
CoFreeUnusedLibrariesEx. This suggests that objects are still active and the unload is doing the correct thing.While this could be a leak, the initial thinking is that this test fails due to the background threads racing to finish up their work as the main thread continues on after the completion is signaled. The name-based tests that expect the module to unload also need to free the activation factories that C++/WinRT caches before calling into the test method, which appears to be giving them enough time to complete successfully.
Change
Add a sleep option to the tests and use it for the failing one. A more invasive solution would be to use the shutdown monitoring the forcibly close out and wait for the background threads, but test only exports are a pain to manage.
Microsoft Reviewers: Open in CodeFlow