You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I believe this affects all JRuby 9k versions that support Thread begin/end trace events (probably all released versions) up through 9.1).
Expected Behavior
MRI in 2.1 or 2.2 added the ability to trace the begin and end of thread life via both set_trace_func and the TracePoint API.
Actual Behavior
On JRuby, the thread begin/end events currently error out, because at least in the case of set_trace_func it is not possible to acquire a thread for the necessary binding:
[--dev] ~/projects/jruby $ jruby --debug -e "set_trace_func(proc {|*a| p a}); Thread.new { return }"
["c-call", "-e", 1, :new, #<Binding:0x8e24743>, #<Class:Thread>]
["c-call", "-e", 1, :initialize, #<Binding:0x23fe1d71>, Thread]
["c-return", "-e", 1, :initialize, #<Binding:0x1d371b2d>, Thread]
["c-return", "-e", 1, :new, #<Binding:0x13eb8acf>, #<Class:Thread>]
Exception in thread "Ruby-0-Thread-1: -e:1" java.lang.ArrayIndexOutOfBoundsException: -1
at org.jruby.runtime.ThreadContext.getCurrentFrame(ThreadContext.java:465)
at org.jruby.runtime.ThreadContext.currentBinding(ThreadContext.java:984)
at org.jruby.Ruby$CallTraceFuncHook.eventHandler(Ruby.java:3133)
at org.jruby.runtime.EventHook.event(EventHook.java:30)
at org.jruby.Ruby.callEventHooks(Ruby.java:3214)
at org.jruby.runtime.ThreadContext.trace(ThreadContext.java:641)
at org.jruby.runtime.ThreadContext.trace(ThreadContext.java:637)
at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:98)
at java.lang.Thread.run(Thread.java:745)
This affects set_trace_func for sure, since it always tries to acquire a binding. It may not affect TracePoint.
This is a regression because 1.7 did not have these top-level thread events, and on 9k they prevent even simple set_trace_func from working properly.
The text was updated successfully, but these errors were encountered:
Ok, set_trace_func is working properly again in the presence of thread begin/end. It turns out we never modified it to only receive the events Ruby 1.8 sent to it, so it was receiving all the new events like :thread_begin. Since it always tries to acquire a binding, it blew up if this event ever fired.
We still need to fix TracePoint, however. I thought it might escape this bug, since it doesn't normally acquire a binding, but it must still be accessing the frame stack somewhere along the way:
Environment
I believe this affects all JRuby 9k versions that support Thread begin/end trace events (probably all released versions) up through 9.1).
Expected Behavior
MRI in 2.1 or 2.2 added the ability to trace the begin and end of thread life via both
set_trace_func
and theTracePoint
API.Actual Behavior
On JRuby, the thread begin/end events currently error out, because at least in the case of set_trace_func it is not possible to acquire a thread for the necessary binding:
This affects
set_trace_func
for sure, since it always tries to acquire a binding. It may not affectTracePoint
.This is a regression because 1.7 did not have these top-level thread events, and on 9k they prevent even simple set_trace_func from working properly.
The text was updated successfully, but these errors were encountered: