Giter Club home page Giter Club logo

Comments (3)

jordanstephens avatar jordanstephens commented on June 9, 2024

I've noticed lately that often the easiest way to un-stick the REPL is to run a sleep from the prompt.

[58, 67] in ~/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activemodel-7.0.8/lib/active_model/error.rb
    58|
    59|       I18n.t(defaults.shift,
    60|         default:  defaults,
    61|         attribute: attr_name,
    62|         message:   message)
=>  63|     end
    64|
    65|     def self.generate_message(attribute, type, base, options) # :nodoc:
    66|       type = options.delete(:message) if options[:message].is_a?(Symbol)
    67|       value = (attribute != :base ? base.read_attribute_for_validation(attribute) : nil)
=>#0	ActiveModel::Error.full_message(attribute="name", message="can't be blank", base=#<Vessel:0x000000012d2b19b0 id: nil, name...) at ~/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activemodel-7.0.8/lib/active_model/error.rb:63 #=> "Name can't be blank"
  #1	ActiveModel::Error#full_message at ~/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activemodel-7.0.8/lib/active_model/error.rb:160
  # and 89 frames (use `bt' command for all frames)
(rdbg) c                # <--- NOTE prompt failed to print the frame here
(rdbg) sleep 5
5                       # <--- NOTE prompt _did_ print the result after sleep
(rdbg) whereami
[48, 57] in ~/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activemodel-7.0.8/lib/active_model/error.rb
    48|
    49|       defaults << :"errors.format"
    50|       defaults << "%{attribute} %{message}"
    51|
    52|       attr_name = attribute.remove(/\.base\z/).tr(".", "_").humanize
=>  53|       debugger
    54|       attr_name = base_class.human_attribute_name(attribute, {
    55|         default: attr_name,
    56|         base: base,
    57|       })
=>#0	ActiveModel::Error.full_message(attribute="drive", message="must be power or sail", base=#<Vessel:0x000000012d2b19b0 id: nil, name...) at ~/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activemodel-7.0.8/lib/active_model/error.rb:53
  #1	ActiveModel::Error#full_message at ~/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activemodel-7.0.8/lib/active_model/error.rb:160
  # and 89 frames (use `bt' command for all frames)

I still don't have a reliable repro, but it does seem to happen very often intermittently. Maybe this offers a clue?

from debug.

st0012 avatar st0012 commented on June 9, 2024

Does it always happen when you debug inside a live Rails server, or it happens when you debug tests too?

Also, could you try setting RUBY_DEBUG_SHOW_FRAMES=0 in your project for a while, which will stop displaying frames when you move forward, and see if the issue still occurs?

I don't have much proof atm, but I suspect it could be caused by inspecting frame arguments causing a livelock due to the thread-freezing mechanism. And evaluating input now temporarily unfreezes threads, which could resolve the locking as a side-effect.

from debug.

jordanstephens avatar jordanstephens commented on June 9, 2024

Does it always happen when you debug inside a live Rails server, or it happens when you debug tests too?

Now I'm wondering if I see it on a live development server—it may just be while debugging specs. And I'm usually debugging system specs that are driving a chrome browser with cuprite. So I wonder if that is related. I tried setting RUBY_DEBUG_SHOW_FRAMES=0 but I'm still seeing the same behaviour.

I've started running sleep 1 when it happens and it always unlocks it.

If you have any diagnostic ideas, let me know. I'm just not sure what to look for.

from debug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.