Stack Level Too Deep when running pry #694

Closed
JonnieCache opened this Issue Aug 22, 2012 · 7 comments

Projects

None yet

5 participants

@JonnieCache

Firstly, we're talking pry 0.9.10 on ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0] on OS X 10.7.4.

One day, I started not being able to run pry at all. It would die like this:

~ ❯ pry
/Users/jonnie/.rbenv/versions/1.9.3-p194/bin/pry:23: stack level too deep (SystemStackError)

At first I thought it was something in .pryrc but I nuked that, no dice.

So I downgraded pry to see if an old version worked. Eventually I got down to 0.9.5 and pry opened again, giving the following output:

~ ❯ pry
Warning: The plugin 'pry-debugger' was not found! (gem found but could not be loaded)
Warning: The plugin 'pry-exception_explorer' was not found! (gem found but could not be loaded)
Warning: The plugin 'pry-nav' was not found! (gem found but could not be loaded)
Warning: The plugin 'pry-stack_explorer' was not found! (gem found but could not be loaded)
pry(main)>

This was obviously the problem: I had evidently installed a new version of pry without updating my old versions of the various plugins. After uninstalling them, the newest version of pry once again loaded without problems. Here are the versions of the plugins I had when I got rid of them:

pry-debugger-0.2.0
pry-nav-0.2.0
pry-nav-0.2.1
pry-stack_explorer-0.4.1
pry-stack_explorer-0.4.2
pry-exception_explorer-0.1.9

I imagine pry only loads the newest installed version but I thought I'd include them all.

In conclusion, maybe pry should specify which versions of the plugins it's tested against? That would be a lot of extra work, so perhaps there could be some kind of rescue in the gem binary script that prints a message telling you to check your plugins if it isn't loading properly. Also a switch like the -f one to disable the loading of plugins would be useful. Perhaps -f could be combined with plugin-disabling to form a 'safe mode' switch.

EDIT: apparently there is already a --no-plugins switch. Manpage blindness can affect us all...

@ConradIrwin
pry member

@JonnieCache I get something similar to this under very limited circumstances:
I have the folllowing in my ~/.pryrc and it only breaks when I start pry in my home directory:

_super = Pry.config.prompt[0]
Pry.config.prompt[0] = lambda{ |*args| _super[*args] }
Pry.config.prompt[1] = lambda{ |*args|  (" " * (Pry.config.prompt[0][*args].size - 2)) + "| " }
@ConradIrwin
pry member

I just got this again running pry inside sidekiq in rails.

from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421

SystemStackError: stack level too deepSystemStackError: stack level too deep

from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421

SystemStackError: stack level too deep
SystemStackError: stack level too deepfrom /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421
from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421
SystemStackError: stack level too deep

SystemStackError: stack level too deepfrom /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421

SystemStackError: stack level too deepfrom /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421
from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421

SystemStackError: stack level too deep
SystemStackError: stack level too deepfrom /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421

SystemStackError: stack level too deepfrom /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421

SystemStackError: stack level too deepfrom /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421

from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421SystemStackError: stack level too deep
SystemStackError: stack level too deep

from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421

SystemStackError: stack level too deepSystemStackError: stack level too deep
from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421

from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421SystemStackError: stack level too deep

from /home/conrad/.rvm/gems/ruby-1.9.3-p194@rescuejs/gems/pry-0.9.10/lib/pry/pry_class.rb:421SystemStackError: stack level too deep

SystemStackError: stack level too deep
@benizi

I'm not sure this is a pry issue, per se. The way pry-nav 0.2.2 is overriding Pry.start seems to be incompatible with how newer versions of pry work. See this issue: nixme/pry-nav#17

The workaround was to simply gem uninstall pry-nav.

@BM5k

I am seeing a similar error that seems to be pry-rails related: I've opened an issue rweng/pry-rails#30.

@banister
pry member

@benizi do you also have pry-debugger installed? Weve confirmed the stack overflow occurs when you have both pry-nav and pry-debugger installed. This kind of makes sense, as they both monkeypatch Pry.start, and i wouldn't be too surprised if all hell breaks loose

crow:pry johnmair$ pry --installed-plugins
Installed Plugins:
--
debugger          Fast debugging with Pry.
doc               Provides YARD and extended documentation support for Pry
exception_explorerEnter the context of exceptions
remote-em         Connect to Pry remotely using EventMachine
stack_explorer    Walk the stack in a Pry session
theme             Easy way to customize your Pry colors
crow:pry johnmair$ gem install pry-nav
Fetching: pry-nav-0.2.2.gem (100%)
Successfully installed pry-nav-0.2.2
1 gem installed
crow:pry johnmair$ pry
/Users/johnmair/.rvm/gems/ruby-1.9.3-p286/bin/pry:23: stack level too deep (SystemStackError)
crow:pry johnmair$ gem uninstall pry-nav && pry
Successfully uninstalled pry-nav-0.2.2
[1] pry(main)> ^D
crow:pry johnmair$ 
@benizi

@banister Yes, indeed. Confirmed that installing one or the other works fine, but having both installed causes trouble.

Also confirmed that changing the way each aliases its method works:

In pry-nav, substituted start_without_pry_nav everywhere it used start_existing, and in pry-debugger, substituted start_without_pry_debugger everywhere. Pull requests at nixme/pry-debugger#20 and nixme/pry-nav#18 .

@banister
pry member

This bug is downstream on pry-nav, pry-debugger, pull requests have been merged & we're waiting for new gem releases

@banister banister closed this Nov 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment