Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

First ever bundle install, stack level too deep

I have created a brand new rails project using the command rails new qbc --database=mysql. It creates all the files perfectly fine, but at the bundle install it errors out

$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/usr/bin/bundle:23: stack level too deep (SystemStackError)

gist.github.com/3956513

I have searched and searched for the solution to this issue but I can't seem to find anyone else who has experienced it. I am developing on Cygwin and I wouldn't be surprised if that has something to do with it.

I tried creating a Gemfile with just the source and one gem in it in an empty directory and bundle install still gives the same error. I have followed all of the troubleshooting steps, reinstalled Cygwin and all packages, everything. What keeps catching my eye is the Fetching gem metadata twice...is it possible that bundler is caught in some kind of loop?

like image 654
ZakThompson Avatar asked Oct 26 '12 02:10

ZakThompson


Video Answer


1 Answers

Cygwin's pthread_attr_getstack reports about 90k by default. I think Cygwin is reporting the committed (used-so-far) stack size, not the reserved (total available) size. Then Ruby is treating that (i.e. 90k) as the maximum stack size ever.

To change the initial committed stack size:

peflags -X409600 `which ruby`

Note the capitalized -X. Lowercase -x changes reserved stack size, not initially-committed stack space.

This fixes all Ruby+Rails+Cygwin issues for me.

I don't know Ruby or Cygwin internals well enough to know which is the right fix, but it's probably one of these.

  • Cygwin reports reserved stack size from pthread_attr_getstack.
  • Ruby adds a build step to run the peflags command above.
  • Ruby determines the available stack space a different way.
like image 94
Mike Avatar answered Oct 06 '22 00:10

Mike