Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
enebo opened this issue Jan 3, 2017 · 4 comments

Comments

@enebo
Copy link
Member

commented Jan 3, 2017

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...

@enebo enebo added this to the JRuby 9.2.0.0 milestone Jan 3, 2017

enebo added a commit that referenced this issue Jan 3, 2017

Revert "Fix deadlock when tearing down runtime during debugging"
This reverts commit f9d704c.

New issue #4419 opened to address this revert.
@enebo

This comment has been minimized.

Copy link
Member Author

commented Jan 3, 2017

I should add this was reverted because simplecov stopped working for multiple users where only a small subset of coverage was being reported.

@PragTob

This comment has been minimized.

Copy link

commented Jan 8, 2017

Adding to what Tom said, there is further info as to how to check the things that caused problems on simplecov in the issue that caused the revert: #4404 (simplecovs integration test suite also helpfully fails :) )

It was also mentioned that it might be simplecovs fault, as in inadequate usage of hooks, I'm not really into the code base but would be willing to help debug issues given I got the time :)

@headius headius modified the milestones: JRuby 9.2.0.0, JRuby 9.2.1.0 May 15, 2018

@headius

This comment has been minimized.

Copy link
Member

commented May 15, 2018

Still failing in 9.2.

@headius

This comment has been minimized.

Copy link
Member

commented Aug 2, 2019

This is deadlocking because TracePoint events are synchronized and they cross over because of the two threads both trying to fire events at each other. I'm looking into a better way to synchronize trace events.

@headius headius closed this in 660b6d8 Aug 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.