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

Cherry-pick of #849: Use os.MkdirAll, which is thread-safe #850

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

agarciamontoro
Copy link
Member

Summary

Cherry-pick #849 to release-1.23. Even though I have not released the RC-1 version yet, the branch is protected and I cannot force-push to it (I should have cut it after #849 was merged, but alas). Anyway, we need to cherry-pick that now.

Ticket Link

--

The same race condition does happen in the implementation of
os.MkdirAll[0], but that code there takes it into account and re-checks
the second error (the one on Mkdir), and it ends up returning nil if the
directory is indeed created, thus avoiding the race condition and making
os.MkdirAll thread-safe.

[0] https://github.com/golang/go/blob/e33f7c42b084182a3a88ef79857e33c11627159a/src/os/path.go#L19-L66
@agarciamontoro agarciamontoro added the 2: Dev Review Requires review by a core committer label Nov 20, 2024
@agarciamontoro agarciamontoro merged commit ef86d90 into release-1.23 Nov 20, 2024
2 checks passed
@agarciamontoro agarciamontoro deleted the cherry-pick.849 branch November 20, 2024 15:21
@agarciamontoro agarciamontoro added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants