-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Issues with concurrent bundle installs with shared gem cache #3191
Comments
@stefansedich thank you for reporting this! @segiddins ugh this scenario did not even occur to me 😭 I'm thinking process lock file a la git? |
FYI my current solution using a install wrapper script does the trick!
|
@indirect if a process lock is the desired solution and everyone is happy with that I am happy to tackle it and submit a PR for it. |
@stefansedich I think that's the way to go for now—we're not designed to allow multiple concurrent processes. Maybe a future goal can be optimizing that beyond a process lock. |
Sounds good, from my initial look it looks like Installer#run is the best place to put the lock, does that sound right to you? |
That sounds right to me. You'll also want to check the update command and make sure it shares the lock. 👍🏻 |
We could also do everything in temporary directories and move stuff since moves are atomic |
@segiddins does it make more sense to just wait? otherwise in this example I compile PG twice in parallel, if we just lock and wait by the time the second install can continue PG should already be compiled and ready to use? |
You've given the install command twice, so I don't think that installing twice is out of the question. In addition, in my experience proper multi-process coordination is a lot harder than just sticking with atomic ops |
Adding process lock for bundle install operations ### What was the end-user problem that led to this PR? As per #5851 multiple concurrent bundle installs would cause failures when compiling ### What was your diagnosis of the problem? As described in #5851 a sample project was created demonstrating the issue when running a docker-compose solution of 2 containers using a gem cache volume ### What is your fix for the problem, implemented in this PR? The fix is to implement an installation process lock so that only one process can execute an install at one time ### Why did you choose this fix out of the possible options? I chose this fix because it was discussed in #5851 as a possible solution
This was apparently fixed by rubygems/bundler#5852, but never closed. |
I am attempting to use a shared gem cache with a docker-compose setup, a sample project is available here: https://github.com/stefansedich/bundle-test which easily replicates the issue by simply running
run.sh
.The error is consistent and one of the two containers will fail to compile the native extensions for in this case the pg gem I assume due to the concurrent installs attempting to create the Makefile.
What is the best way to handle this scenario, my current solution is to wrap my bundle install in a script that will use flock to limit concurrent installs.
The text was updated successfully, but these errors were encountered: