Skip to content

exit! and --debug events can cause a deadlock #4419

@enebo

Description

@enebo

This is an issue made because I had to revert the PR (Fix deadlock when tearing down runtime during debugging #4352). I don't know if I am thick but I can also trivially deadlock with this:

def foo
  1
end


2.times do
  puts "T"
  Thread.new {
    a = []
    [:call, :c_call, :return, :c_return].each do |n|
      t = TracePoint.new(n) { |tp| p tp.event }
      t.enable
    end
    loop do
      sleep 0.01
      foo
    end
  }
end

sleep 0.5
exit!

I think it is because both threads need to receive an event callback but the event callback is generating an event callback and we deadlock? In any case I threw this second deadlock into this issue...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions