Skip to content

Weird stepping behaviour when used with puma 6.0 #799

Closed

Description

@st0012

Your environment

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

Activity

  1. ko1 commented on Nov 18, 2022

    @ko1
    Collaborator

    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.

  2. added
    bugSomething isn't working
    on Nov 18, 2022
  3. added this to the milestone on Nov 18, 2022
  4. st0012 commented on Nov 19, 2022

    @st0012
    MemberAuthor

    @ko1 That sounds good, thank you 🙏

  5. ko1 commented on Nov 24, 2022

    @ko1
    Collaborator

    I confirmed that without #746 it stops at next line.

  6. added a commit that references this issue on Nov 25, 2022
    461d3fd
  7. st0012 commented on Nov 25, 2022

    @st0012
    MemberAuthor

    I can confirm that it now works as expected. Thanks for the fix 👍

  8. added a commit that references this issue on Sep 2, 2024
    3e3f374
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions