-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
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 = TracePoint.new(:thread_begin) {|*a| p a }; t.enable; Thread.new { }.join"
Exception in thread "RubyThread-2: -e:1" java.lang.ArrayIndexOutOfBoundsException: -1
at org.jruby.runtime.ThreadContext.popFrame(ThreadContext.java:428)
at org.jruby.runtime.ThreadContext.postTrace(ThreadContext.java:1184)
at org.jruby.ext.tracepoint.TracePoint$2.eventHandler(TracePoint.java:105)
at org.jruby.runtime.EventHook.event(EventHook.java:30)
at org.jruby.Ruby.callEventHooks(Ruby.java:2899)
at org.jruby.runtime.ThreadContext.trace(ThreadContext.java:648)
at org.jruby.runtime.ThreadContext.trace(ThreadContext.java:644)
at org.jruby.internal.runtime.RubyRunnable.run(RubyRunnable.java:98)
at java.lang.Thread.run(Thread.java:744)
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.
Reactions are currently unavailable