Make tracepoints with set_trace_func or TracePoint.new ractor local#15468
Merged
luke-gru merged 1 commit intoruby:masterfrom Dec 16, 2025
Merged
Make tracepoints with set_trace_func or TracePoint.new ractor local#15468luke-gru merged 1 commit intoruby:masterfrom
luke-gru merged 1 commit intoruby:masterfrom
Conversation
7e80eaf to
480abc0
Compare
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]
1e41e82 to
eda1848
Compare
ivoanjo
added a commit
to DataDog/dd-trace-rb
that referenced
this pull request
Jan 5, 2026
**What does this PR do?** For a while now, whenever the GC and more importantly the allocation profiling features were enabled, we logged a user-visible message that if Ractors were used, a bug in Ruby could cause the profiler to miss data (due to https://bugs.ruby-lang.org/issues/19112 ). The upstream issue has been fixed in <ruby/ruby#15468> (some discussion as well in <ruby/ruby#7184> ). Thus, this PR does a few small things: * Update the logged messages to mention the bug doesn't happen on Ruby 4 * Moves all messages to be debug-level messages (our logic already made sure they were only printed on Ruby 3, hah turns out we predicted this!) In particular our concern in the past for making the message user-visible by default was that customers might use Ractors and run into this issue. As it turns out that in Ruby 3 ractors were always experimental and had a number of bugs/issues, we don't expect anyone to run Ractors in production with Ruby 3. (Maybe this will change with Ruby 4?) * Removes the `OnlyOnce` that was used to limit verboseness -- this is extra complexity that we don't need to maintain now that the log is debug level **Motivation:** Avoid annoying customers with log messages about Ractor support on Ruby 3. **Additional Notes:** N/A **How to test the change?** For the warnings themselves, I've updated our tests to match the new setup. For the upstream issue, I manually used the testcase from https://bugs.ruby-lang.org/issues/19112 and added prints to the profiling GC and NEWOBJ tracepoints, confirming that on Ruby 3.4 they get disabled but on Ruby 4.0 they work fine. I considered adding an explicit test for this but it seems a bit brittle as it would be a test for something not happening after Ractor GC which is kinda fishy to test for, so I ended up not doing it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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]