Ruby: bundle install hangs indefinitely with high CPU usage
Actually, I’m not a Ruby developer but I had an opportunity to help move some Ruby applications from EC2 to Lambda on AWS. At that time, I had an issue when I execute "bundle install" inside the container to build with the SAM framework. The problem was the command didn’t finish indefinitely. I searched about it and found some people who had the same issue but there was no way to work around it. I think changing or deleting versions will solve the problem. Let me share how to do that.
First, comment out all lines in the Gemfile, and then enable a package one by one. If you find the package which is the cause of the hanging, try the following way.
- If it’s already specified some version, delete it.
- Specify its latest version explicitly.
- Specify the previous version of the latest one or the one after next
In my case, "activesupport" was the cause of the issue. Before I modified the Gemfile, it did have specified versions explicitly and installed "6.0.3.4" automatically by bundle. However, I checked rubygems.org and the latest version was "6.1.1" so I wrote it down like this and the problem was solved.
1gem 'activesupport', '~> 6.1.1'
I’m not sure this way will solve all the same issues but I hope it will be helpful for somebody who has the same problems.