Fix .aws/config destroying multi-process concurrency bug#16
Draft
Fix .aws/config destroying multi-process concurrency bug#16
Conversation
aws-google…ess file trashing
09fd5a2 to
8f3137b
Compare
Author
|
Hmmm, found what might be an issue, or maybe I'm just using it wrong locally from the source dir? Going draft since I'm on vacation for a bit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fix multiprocess concurrency bug that trashes ~/.aws files
Prevents the error:
Unable to parse config file:where you have to either fix~/.aws/configor delete~/.aws/credentials. Suddenly its rock solid!We previously had a mutex to try to prevent the worst of these, but this only works with threads. If multiple processes try to use
aws-googleat once, they can simultaneously runaws configure set ...which writes to both ~/.aws/config and ~/.aws/credentials, trashing one or the other.The solution in this PR is to use an
flockon ~/.aws/aws-google.lock, which can synchronize access by multiple processes. To prevent infinite hangs, processes will only block for 60s on the lock before raising an exception.Because an
flockis a kernel level feature on a file descriptor, when the descriptor is destroyed, even if the process ends in a SEGFAULT or whatever, the kernel should delete the lockfile.Testing
bin/aws_accessruns at once.