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

TracePoint thread_begin and thread_end events are broken #1321

headius opened this issue Dec 10, 2013 · 1 comment

TracePoint thread_begin and thread_end events are broken #1321

headius opened this issue Dec 10, 2013 · 1 comment


Copy link

headius commented Dec 10, 2013

The thread_begin and thread_end events used by TracePoint (2.0 feature) do not work properly because they expect execution frames to be available on ThreadContext. For example:

 $ jruby --debug -e "t = {|*a| p a }; t.enable; { }.join"
Exception in thread "RubyThread-2: -e:1" java.lang.ArrayIndexOutOfBoundsException: -1
    at org.jruby.runtime.ThreadContext.popFrame(
    at org.jruby.runtime.ThreadContext.postTrace(
    at org.jruby.ext.tracepoint.TracePoint$2.eventHandler(
    at org.jruby.runtime.EventHook.event(
    at org.jruby.Ruby.callEventHooks(
    at org.jruby.runtime.ThreadContext.trace(
    at org.jruby.runtime.ThreadContext.trace(

I'm not exactly sure how to properly fire these trace events since they need to happen outside the thread's block, but at that point not all ThreadContext structures necessary for execution have been prepared.

Note also that it fails on the postTrace side, which is strange.

This was discovered while fixing #1318.

@enebo enebo modified the milestone: JRuby Jul 14, 2015
@enebo enebo added this to the JRuby milestone Feb 17, 2017
Copy link

enebo commented Feb 17, 2017

Drive-by test and we appear to be sending tracepoints for threads now. The output is not quite the same as MRI but they seem to be happening:

jruby --debug -e 't2 = { |a| puts "START: #{a}"}; t = {|a| puts "END: #{a}" }; t2.enable; t.enable; 10.times { { } }; sleep 4'

Any other changes needed for output or missing state can become a new issue.

@enebo enebo closed this as completed Feb 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants