Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: You want to finish 4 frames, but stack size is only 1 #163

Open
bbugh opened this issue Mar 8, 2018 · 7 comments
Open

RuntimeError: You want to finish 4 frames, but stack size is only 1 #163

bbugh opened this issue Mar 8, 2018 · 7 comments

Comments

@bbugh
Copy link

bbugh commented Mar 8, 2018

Hello! pry-byebug is awesome and you are awesome. Thanks for saving my butt from printf debugging so many times, I'm so spoiled that when I go use other languages I'm sad not to have anything like this.

I am having a strange issue with pry-byebug. Google sends me to a few other Github issues that are several years old, but none have a resolution. I am getting this error when doing binding.pry in a very simple Ruby script.

RuntimeError: You want to finish 4 frames, but stack size is only 1
from /Users/bbugh/.rvm/gems/ruby-2.5.0/gems/pry-byebug-3.6.0/lib/byebug/processors/pry_processor.rb:18:in `step_out'

If I uninstall the gem pry-byebug then it works fine and I get the pry prompt as expected.

To reproduce using the script, just run ruby main.rb and when the first prompt pops up, do player.remove_component(:velocity) and you'll (hopefully) get the error.

» ruby -v
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin16]

» gem -v
2.7.3

» gem list pry
*** LOCAL GEMS ***

pry (0.11.3)
pry-byebug (3.6.0)
pry-rails (0.3.6)

Full backtrace:

[1] pry(main)> player.remove_component(:velocity)
RuntimeError: You want to finish 4 frames, but stack size is only 1
from /Users/bbugh/.rvm/gems/ruby-2.5.0/gems/pry-byebug-3.6.0/lib/byebug/processors/pry_processor.rb:18:in `step_out'
[2] pry(main)> wtf?
Exception: RuntimeError: You want to finish 4 frames, but stack size is only 1
--
0: /Users/bbugh/.rvm/gems/ruby-2.5.0/gems/pry-byebug-3.6.0/lib/byebug/processors/pry_processor.rb:18:in `step_out'
1: /Users/bbugh/.rvm/gems/ruby-2.5.0/gems/pry-byebug-3.6.0/lib/byebug/processors/pry_processor.rb:18:in `start'
2: /Users/bbugh/.rvm/gems/ruby-2.5.0/gems/pry-byebug-3.6.0/lib/pry-byebug/pry_ext.rb:8:in `start_with_pry_byebug'
3: /Users/bbugh/.rvm/gems/ruby-2.5.0/gems/pry-0.11.3/lib/pry/core_extensions.rb:43:in `pry'
4: main.rb:21:in `remove_component'
5: (pry):1:in `<main>'
6: /Users/bbugh/.rvm/gems/ruby-2.5.0/gems/pry-0.11.3/lib/pry/pry_instance.rb:355:in `eval'
7: /Users/bbugh/.rvm/gems/ruby-2.5.0/gems/pry-0.11.3/lib/pry/pry_instance.rb:355:in `evaluate_ruby'
8: /Users/bbugh/.rvm/gems/ruby-2.5.0/gems/pry-0.11.3/lib/pry/pry_instance.rb:323:in `handle_line'
9: /Users/bbugh/.rvm/gems/ruby-2.5.0/gems/pry-0.11.3/lib/pry/pry_instance.rb:243:in `block (2 levels) in eval'
@deivid-rodriguez
Copy link
Owner

Hi @bbugh. First of all, thanks for your kind words ❤️.

Second, thanks for the report. It uses up to date ruby and it seems easily reproducible... 👍

Another thing you could try to further isolate it is replace pry-byebug with byebug and binding.pry with byebug. If it still reproduces, then we should move this ticket to the byebug repo.

@bbugh
Copy link
Author

bbugh commented Mar 11, 2018

Good call, I tried it with just byebug and the issue still happened.

I didn't think about that since I was actually not loading pry-byebug—only pry was in the Gemfile. The on/off switch for this error was simply having it installed or not. It was a red herring! 🐟

Should I make another bug in the byebug repo?

@deivid-rodriguez
Copy link
Owner

Yes, please!

@anquegi
Copy link

anquegi commented Jun 14, 2018

I have the same error but only in this situation, with pry (0.11.3) pry-byebug (3.6.0) installed and ruby 2.5.1, When I use edit -c after going out of the emacs editor (or vim) I get the followinf trace:

ruby h2d.rb                                                                                                                                                                                                       

From: /Users/toni/learn/ruby/ruby-laguna/h2d.rb @ line 7 :

     2: # frozen_string_literal: true
     3:
     4: require 'pry'
     5: binding.pry
     6:
 =>  7: def h2d(hex)
     8:   raise SyntaxError, "Not an hex number: #{hex}" if hex !~ /^\s*0x[\dA-F]+\s*$/i
     9:   hex.hex
    10: end
    11:
    12: ARGV.each { |h| puts(h2d(h)) }

[1] pry(main)> edit -c
RuntimeError: You want to finish 4 frames, but stack size is only 1
from /Users/toni/.rvm/gems/ruby-2.5.1@learn-laguna/gems/pry-byebug-3.6.0/lib/byebug/processors/pry_processor.rb:18:in `step_out'
[1] pry(main)> wtf?
Exception: RuntimeError: You want to finish 4 frames, but stack size is only 1
--
0: /Users/toni/.rvm/gems/ruby-2.5.1@learn-laguna/gems/pry-byebug-3.6.0/lib/byebug/processors/pry_processor.rb:18:in `step_out'
1: /Users/toni/.rvm/gems/ruby-2.5.1@learn-laguna/gems/pry-byebug-3.6.0/lib/byebug/processors/pry_processor.rb:18:in `start'
2: /Users/toni/.rvm/gems/ruby-2.5.1@learn-laguna/gems/pry-byebug-3.6.0/lib/pry-byebug/pry_ext.rb:8:in `start_with_pry_byebug'
3: /Users/toni/.rvm/gems/ruby-2.5.1@learn-laguna/gems/pry-0.11.3/lib/pry/core_extensions.rb:43:in `pry'
4: h2d.rb:5:in `<top (required)>'
5: /Users/toni/.rvm/gems/ruby-2.5.1@learn-laguna/gems/pry-0.11.3/lib/pry/commands/edit.rb:124:in `load'
6: /Users/toni/.rvm/gems/ruby-2.5.1@learn-laguna/gems/pry-0.11.3/lib/pry/commands/edit.rb:124:in `block in file_edit'
7: /Users/toni/.rvm/gems/ruby-2.5.1@learn-laguna/gems/pry-0.11.3/lib/pry/helpers/base_helpers.rb:10:in `silence_warnings'
8: /Users/toni/.rvm/gems/ruby-2.5.1@learn-laguna/gems/pry-0.11.3/lib/pry/commands/edit.rb:123:in `file_edit'
9: /Users/toni/.rvm/gems/ruby-2.5.1@learn-laguna/gems/pry-0.11.3/lib/pry/commands/edit.rb:53:in `process'
[2] pry(main)> edit
=> nil

When I use edti without -c option, it works well, If I remove pry-byebug gem it also works well, and if I use only byebug it also works well

@rrcobb
Copy link

rrcobb commented Jul 5, 2018

Minimal reproducible example:

# minimal_reproducible_example.rb
require 'pry'

def a_method
  binding.pry
end

binding.pry
puts 'hello'
$ ruby minimal_reproducible_example.rb

From: /Users/____/yak-shave/minimal_reproducible_example.rb @ line 8 :

    3: def a_method
    4:   binding.pry
    5: end
    6:
    7: binding.pry
 => 8: puts 'hello'

[1] pry(main)> a_method
RuntimeError: You want to finish 4 frames, but stack size is only 1
from /Users/_______/.rvm/gems/ruby-2.3.3/gems/pry-byebug-3.6.0/lib/byebug/processors/pry_processor.rb:18:in `step_out'

I share the confusion about why pry-byebug is in the trace, even though only pry is require'd

$ gem list pry
pry (0.11.3)
$ gem list byebug
byebug (10.0.2)
$ gem list pry-byebug
pry-byebug (3.6.0)
$ ruby --version
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-darwin17]

It looks like the key to reproducing is just having pry-byebug installed, then calling a method that tries to call another binding.pry.

The solution that works to solve this example (though not satisfyingly explain it, nor solve the issues for those who would like to use pry-byebug) is

$ gem uninstall pry-byebug

@valterbarros
Copy link

@rrcobb Thanks a lot

@AHaymond
Copy link

AHaymond commented Apr 7, 2021

3 years later and this issue still persists. Has any further investigation ever been made to try and solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants