ZakThompson
ZakThompson

Reputation: 193

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?

Upvotes: 14

Views: 3328

Answers (3)

Mike
Mike

Reputation: 1189

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.

Upvotes: 20

Liam Dawson
Liam Dawson

Reputation: 1199

Unfortunately, I don't think this answer is likely to be helpful, as it doesn't make any sense, but I solved it by:

$ gem install rake
$ gem install bundler

$ bundle install

It worked at that point without running into the same error.

Upvotes: 1

Adam Hawes
Adam Hawes

Reputation: 5449

Windows binaries encode the preferred stack size in the executable header. Cygwin binaries default to about 2M.

You can change this:

peflags -x8192000 `which ruby`

and re-run 'bundle install'. It's been working for me that way for some time now.

Upvotes: 0

Related Questions