Repository navigation
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Your environment
ruby -v:3.1.2rdbg -v: Current master: a402e73 (but the issue can be reproduced with commits as early as c3d9257)
Describe the bug
When using the latest ruby/debug with Puma 6.0+, stepping over (or next command) could enter weird places (e.g. zeitwerk's internal). For example:
[2, 11] in ~/projects/debug-issue/app/controllers/posts_controller.rb
2| before_action :set_post, only: %i[ show edit update destroy ]
3|
4| # GET /posts or /posts.json
5| def index
6| binding.b
=> 7| @posts = Post.all
8| a = 1
9| b = 2
10| end
11|
=>#0 PostsController#index at ~/projects/debug-issue/app/controllers/posts_controller.rb:7
#1 ActionController::BasicImplicitRender#send_action(method="index", args=[]) at ~/.gem/ruby/3.1.2/gems/actionpack-7.0.4/lib/action_controller/metal/basic_implicit_render.rb:6
# and 76 frames (use `bt' command for all frames)
(rdbg) n # next command
[23, 32] in ~/.gem/ruby/3.1.2/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb
23| alias_method :zeitwerk_original_require, :require
24| end
25|
26| # @sig (String) -> true | false
27| def require(path)
=> 28| if loader = Zeitwerk::Registry.loader_for(path)
29| if path.end_with?(".rb")
30| required = zeitwerk_original_require(path)
31| loader.on_file_autoloaded(path) if required
32| required
=>#0 Kernel#require(path="/Users/hung-wulo/projects/debug-issue/ap...) at ~/.gem/ruby/3.1.2/gems/zeitwerk-2.6.6/lib/zeitwerk/kernel.rb:28
#1 PostsController#index at ~/projects/debug-issue/app/controllers/posts_controller.rb:7
# and 77 frames (use `bt' command for all frames)
To Reproduce
Please clone this vanilla Rails app and follow the instructions in the readme.
Expected behavior
Typing n should go to line 8 instead of entering zeitwerk's internal.
Additional context
- It's highly related to Faster next / finish by using
rb_profile_frames#746. cc @WillHalto - It works fine with
puma 5.0
Reacted by Etienne van Delden de la Haije and Jere Robles
Reacted by Will Haltom
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Activity
ko1 commentedon Nov 18, 2022
Thank you, so I'll revert #746, unfortunately.
I'll introduce another technique for Ruby 3.2, but 3.1 or before has performance issue.
st0012 commentedon Nov 19, 2022
@ko1 That sounds good, thank you 🙏
ko1 commentedon Nov 24, 2022
I confirmed that without #746 it stops at next line.
revert #746
st0012 commentedon Nov 25, 2022
I can confirm that it now works as expected. Thanks for the fix 👍
revert ruby#746