From 4fb537b1ee28bb37dbe551ac65c279d436c756bc Mon Sep 17 00:00:00 2001 From: Luke Gruber Date: Tue, 16 Dec 2025 14:06:55 -0500 Subject: Make tracepoints with set_trace_func or TracePoint.new ractor local (#15468) Before this change, GC'ing any Ractor object caused you to lose all enabled tracepoints across all ractors (even main). Now tracepoints are ractor-local and this doesn't happen. Internal events are still global. Fixes [Bug #19112] --- trace_point.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'trace_point.rb') diff --git a/trace_point.rb b/trace_point.rb index 682398ec3f..7e8af21a68 100644 --- a/trace_point.rb +++ b/trace_point.rb @@ -26,7 +26,7 @@ # change. Instead, it is recommended to specify the types of events you # want to use. # -# To filter what is traced, you can pass any of the following as +events+: +# To filter what is traced, you can pass any number of the following as +events+: # # +:line+:: Execute an expression or statement on a new line. # +:class+:: Start a class or module definition. @@ -74,7 +74,7 @@ class TracePoint # # A block must be given; otherwise, an ArgumentError is raised. # - # If the trace method isn't included in the given events filter, a + # If the trace method isn't supported for the given event(s) filter, a # RuntimeError is raised. # # TracePoint.trace(:line) do |tp| @@ -89,7 +89,9 @@ class TracePoint # end # $tp.lineno #=> access from outside (RuntimeError) # - # Access from other threads is also forbidden. + # Access from other ractors, threads or fibers is forbidden. TracePoints are active + # per-ractor so if you enable a TracePoint in one ractor, other ractors will not be + # affected. # def self.new(*events) Primitive.attr! :use_block -- cgit v1.2.3