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 potential race condition of MaybeCreateDirectory #683

Merged
merged 2 commits into from
Aug 6, 2023

Conversation

wengxt
Copy link
Contributor

@wengxt wengxt commented Aug 5, 2023

If a directory is being created by two threads at the same time, it is possible that one succeed while the other fails. This change the order of create & check, so no matter which thread create the directory first, it will always succeed in the end.

Pull request

Issue tracker

Fixes will automatically close the related issue

Fixes #

Feature

Describe feature of pull request

Unit test

  • Done

Manual test

  • Done

Code Review

  1. Unit and manual test pass
  2. GitHub Action CI pass
  3. At least one contributor reviews and votes
  4. Can be merged clean without conflicts
  5. PR will be merged by rebase upstream base

Additional Info

wengxt and others added 2 commits August 5, 2023 10:33
If a directory is being created by two threads at the same time, it is possible that one succeed while the other fails. This change the order of create & check, so no matter which thread create the directory first, it will always succeed in the end.
@eagleoflqj eagleoflqj merged commit e391bc2 into rime:master Aug 6, 2023
groverlynn pushed a commit to groverlynn/librime that referenced this pull request Sep 27, 2023
* Fix a potential race condition of MaybeCreateDirectory

---------

Co-authored-by: Qijia Liu <[email protected]>
graphemecluster pushed a commit to TypeDuck-HK/librime that referenced this pull request Nov 2, 2023
* Fix a potential race condition of MaybeCreateDirectory

---------

Co-authored-by: Qijia Liu <[email protected]>
graphemecluster pushed a commit to TypeDuck-HK/librime that referenced this pull request Nov 8, 2023
* Fix a potential race condition of MaybeCreateDirectory

---------

Co-authored-by: Qijia Liu <[email protected]>
graphemecluster pushed a commit to TypeDuck-HK/librime that referenced this pull request Mar 18, 2024
* Fix a potential race condition of MaybeCreateDirectory

---------

Co-authored-by: Qijia Liu <[email protected]>
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.

2 participants