Fix a race condition in the object store logger #1328
Merged
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.
The Object Store Logger had a race condition in
post_close
where the workers could be shut down before all files were enqueued, due to the same flag being used multiple times. Specifically, if all workers saw an empty queue after the shutdown flag was set while the enqueueing thread was sleeping, then the worker pool would shut down, even if there were objects left to enqueue.Fixed by adding a second flag to trigger shutdown of the enquing thread that is seperate from the flag used to shutdown the worker pool.
Did not add a new test case to verify the "fix", as it is impossible to deterministically trigger this race condition via the public API.
Closes https://mosaicml.atlassian.net/browse/CO-638