bundler cannot allocate enough memory on ruby on rails application using ubuntu 12.10 ?

November 1, 2013 22.4k views
Been following this tutorial which makes it look easy, but that's very far from the case : https://www.digitalocean.com/community/articles/how-to-1-click-install-ruby-on-rails-on-ubuntu-12-10-with-digitalocean So after sending my app via SFTP and following the tutorial, i get stuck at bundle install and i get this error everytime i try it. Any ideas ? any help would be greatly appreciated! thanks : root@mtlfixed:/home/rails/ror_ecommerce# bundle install Fetching source index from http://rubygems.org/ Fetching https://github.com/binarylogic/authlogic.git Retrying git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks due to error (2/3): Cannot allocate memory - git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks Retrying git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks due to error (3/3): Cannot allocate memory - git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks Retrying source fetch due to error (2/3): Cannot allocate memory - git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks Fetching https://github.com/binarylogic/authlogic.git Retrying git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks due to error (2/3): Cannot allocate memory - git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks Retrying git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks due to error (3/3): Cannot allocate memory - git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks Retrying source fetch due to error (3/3): Cannot allocate memory - git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks Fetching https://github.com/binarylogic/authlogic.git Retrying git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks due to error (2/3): Cannot allocate memory - git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks Retrying git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks due to error (3/3): Cannot allocate memory - git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks Unfortunately, a fatal error has occurred. Please see the Bundler troubleshooting documentation at http://bit.ly/bundler-issues. Thanks! /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/source/git/git_proxy.rb:114:in ``': Cannot allocate memory - git clone 'https://github.com/binarylogic/authlogic.git' "/usr/local/rvm/gems/ruby-2.0.0-p247/cache/bundler/git/authlogic-b72cf620c3fcce74db4378e480f903d8dabb4a7e" --bare --no-hardlinks (Errno::ENOMEM) from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/source/git/git_proxy.rb:114:in `block (2 levels) in git' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/shared_helpers.rb:68:in `call' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/shared_helpers.rb:68:in `with_clean_git_env' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/source/git/git_proxy.rb:114:in `block in git' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/retry.rb:37:in `call' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/retry.rb:37:in `run' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/retry.rb:27:in `attempt' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/source/git/git_proxy.rb:113:in `git' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/source/git/git_proxy.rb:73:in `checkout' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/source/git.rb:144:in `specs' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/lazy_specification.rb:53:in `__materialize__' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/spec_set.rb:88:in `block in materialize' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/spec_set.rb:85:in `map!' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/spec_set.rb:85:in `materialize' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/definition.rb:133:in `specs' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/definition.rb:122:in `resolve_remotely!' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/installer.rb:86:in `block in run' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/retry.rb:37:in `call' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/retry.rb:37:in `run' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/retry.rb:27:in `attempt' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/installer.rb:85:in `run' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/installer.rb:15:in `install' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/cli.rb:257:in `install' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/vendor/thor/command.rb:27:in `run' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_command' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/vendor/thor.rb:363:in `dispatch' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/vendor/thor/base.rb:438:in `start' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/cli.rb:10:in `start' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/bin/bundle:22:in `block in ' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors' from /usr/local/rvm/gems/ruby-2.0.0-p247@global/gems/bundler-1.4.0.rc.1/bin/bundle:22:in `' from /usr/local/rvm/gems/ruby-2.0.0-p247/bin/bundle:23:in `load' from /usr/local/rvm/gems/ruby-2.0.0-p247/bin/bundle:23:in `' from /usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `eval' from /usr/local/rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:15:in `' root@mtlfixed:/home/rails/ror_ecommerce#
4 Answers
by Etel Sverdlov
Linux swaps allow a system to harness more memory than was originally physically available. Here's how to set up a linux swap file on Ubuntu 12.04
Is creating a swap the only way to solve the memory issue? Is this is a sign that we should be increasing our droplet size?
@jmstone617: It varies on a case by case basis. Sometimes running out of memory can happen due to a one time or infrequent process that uses a lot of memory. In that case, adding some swap is a great solution. But if you're swapping frequently, it's definitely a sign that you should scale up to a larger droplet.
Have another answer? Share your knowledge.