-
Notifications
You must be signed in to change notification settings - Fork 50
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
bugfix: Fixup race condition when installing near-sandbox #46
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this still fail if the env variable for the near bin location is unset on first compiling but then set when running? Is the race condition just that the second instance would try to use the binary before it is downloaded and initialized because it passed the check that it exists?
The env variable is only used for overriding the location of the binary in the case where the user wants to manually install
it's slightly more interesting: from what I surmised, both instance would try to install at the same time, corrupting the binary. The |
Then is there something that should be done around making these installations in different locations or having some lock on the file instead of just appending through the download? Is the issue with the move or the download into temp folder (is the temp folder the same?) I just want to make sure we aren't just doing a band-aid fix that would uncover other issues later if we hit another race condition |
the temp folder is the same which is the issue
Good point. Just for good measure then, let me add in a lockfile to lock it from being attempting to install a second binary in the |
What do you mean specifically by having a lockfile? Do you mean using something like |
yeah something like |
This should fix the issue, and I've opened up near/near-sandbox#21 to address it on the sandbox installation side |
Move installing the near-sandbox binary into
build.rs
as to not contend with multiple tests trying to install it at once.Fixes: #44