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

Writing .r10k-deploy.json is not atomic #813

Closed
credbbl opened this issue May 18, 2018 · 0 comments · Fixed by #1039
Closed

Writing .r10k-deploy.json is not atomic #813

credbbl opened this issue May 18, 2018 · 0 comments · Fixed by #1039
Labels

Comments

@credbbl
Copy link

credbbl commented May 18, 2018

r10k rewrites one file: .r10k-deploy.json. This process is not done atomically by open(O_TRUNC), write, close. This means that the file is empty for some time and the empty string is no valid JSON.

We have a failure rate of about one in 1000 Puppet runs, where the config_version script is unable to determine the version as the file is empty at this time.

Please write this file to a temporary location and replace the old one atomically.

binford2k added a commit to binford2k/r10k that referenced this issue Mar 11, 2020
This isn't quite atomic, but it's really close. And AFAIK, it's as close
as we can get to atomic in pure Ruby since `flock` is advisory.

Fixes puppetlabs#813
@adrienthebo adrienthebo changed the title Writing .r10k-deply.json is not atomic Writing .r10k-deploy.json is not atomic Mar 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants