Skip to content
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

Fix a race condition in the object store logger #1328

Merged
merged 2 commits into from
Aug 1, 2022

Conversation

ravi-mosaicml
Copy link
Contributor

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

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. 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
Copy link
Contributor

@jbloxham jbloxham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Can't think of any race conditions exposed here.

composer/loggers/object_store_logger.py Show resolved Hide resolved
@ravi-mosaicml ravi-mosaicml merged commit d5159d7 into mosaicml:dev Aug 1, 2022
@ravi-mosaicml ravi-mosaicml deleted the CO-638 branch August 1, 2022 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants