Remove the task from the task list at the end of task destruction #11117
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.
Summary:
Previously the running task counter is decremented as part of member destruction.
Recent changes to track the running task in a global list for stats tracking but
we remove it from the list at the entry of the task destructor so there is race
condition between the task destruction thread running at the background and the
test shutdown thread. The fix is to move the task list remove at the end of task
destructor. Also note that we manually destroy class members in task destructor
so it is fine to remove the task list in destructor.
Reviewed By: spershin
Differential Revision: D63546925