Skip to content

IRB crashes when started from ruby/debug session in Rails #1003

Closed

Description

@dhh

With a new Rails app created from rails/main, IRB consistently crashes when invoked from a ruby/debug session started using debugger on Ruby 3.3.5. This is the error and backtrace:

(rdbg) irb    # command
irb_console = true                 # UI: Use IRB as the console (default: false)
>> #<Thread:0x000074c1d2f0d170@DEBUGGER__::SESSION@server /home/dhh/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/debug-1.9.2/lib/debug/session.rb:179 run> terminated with exception (report_on_exception is true):
/home/dhh/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/irb-1.14.0/lib/irb/debug.rb:72:in `block in setup': undefined method `call' for nil (NoMethodError)

            irb_output_modifier_proc.call(output, complete: complete)
                                    ^^^^^
        from /home/dhh/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/reline-0.5.10/lib/reline/line_editor.rb:783:in `modify_lines'
        from /home/dhh/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/reline-0.5.10/lib/reline/line_editor.rb:353:in `block in modified_lines'
        from /home/dhh/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/reline-0.5.10/lib/reline/line_editor.rb:346:in `with_cache'
        from /home/dhh/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/reline-0.5.10/lib/reline/line_editor.rb:352:in `modified_lines'
        from /home/dhh/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/reline-0.5.10/lib/reline/line_editor.rb:376:in `wrapped_prompt_and_input_lines'
        from /home/dhh/.local/share/mise/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/reline-0.5.10/lib/reline/line_editor.rb:441:in `wrapped_cursor_position'

Steps to reproduce:

rails new myapp
cd myapp
bin/rails generate scaffold message title:string
# edit app/controllers/messages_controller.rb and add "debugger" in the new action
bin/rails server
# Visit http://localhost:3000/messages/new
# Enter "irb" in the rdbg session that is started in the console

This is with debug 1.9.2, Ruby 3.3.5, and rails/main.

IRB does not crash if instead of debugger you start the IRB session using binding.irb. But that's not a replacement. Often it's useful to run in rdbg to use the full debugger, and only occasionally hoping into IRB.

Activity

  1. changed the title [-]IRB frequently crashes when started from ruby/debug session in Rails[/-] [+]IRB crashes when started from ruby/debug session in Rails[/+] on Sep 9, 2024
  2. st0012 commented on Oct 1, 2024

    @st0012
    Member

    Closing as it's been fixed in #1006 and was released in v1.14.1.

  3. dhh commented on Oct 4, 2024

    @dhh
    Author

    Can confirm this is fixed. Thanks! 🙏

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