-
Notifications
You must be signed in to change notification settings - Fork 398
[PROF-13115] Fix profiler support for Ruby 4.0.0-preview2 #5091
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
[PROF-13115] Fix profiler support for Ruby 4.0.0-preview2 #5091
Conversation
Looks like this symbol was hidden again. We only use it for debugging anyway...
With 4.0.0-preview2 this spec is working fine.
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage 🔗 Commit SHA: 49e66f9 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
BenchmarksBenchmark execution time: 2025-11-25 14:04:17 Comparing candidate commit 49e66f9 in PR branch Found 2 performance improvements and 0 performance regressions! Performance is the same for 42 metrics, 2 unstable metrics. scenario:error - error tracking, with_error=true - third_party only
scenario:profiling - Allocations ()
|
lloeki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
**What does this PR do?** This PR disables the heap profiling feature when running on Ruby 4 as the current implementation (that relies on object_id) is not safe to use on Ruby 4. **Motivation:** Avoid impacting applications running on Ruby 4. **Additional Notes:** Discussion with the Ruby core team in https://bugs.ruby-lang.org/issues/21710 has uncovered that our use of object_id from inside the NEWOBJ tracepoint is not safe on Ruby 4, and it's likely it can't be made safe. Until we're able to replace the Datadog profiler's usage of object_id for heap profiling, we won't be able to safely offer this feature on Ruby 4. (We temporarily disabled the heap profiler for 4.0.0-preview2 in #5091 and re-enabled it in #5121 when it looked fixed but discussion on the upstream ticket uncovered further issues) **How to test the change?** Validate that profiler doesn't enable heap profiling on Ruby 4.
What does this PR do?
This PR contains 3 small fixes for profiler support in Ruby 4.0.0-preview2:
rb_obj_infois not available in Ruby 4pendingfrom a spec that didn't work on Ruby 3.5.0-preview1It does not affect other Ruby versions.
Motivation:
This PR, together with #5090 and DataDog/datadog-ruby_core_source#18 is needed to get a green CI for the profiler on Ruby 4.
Change log entry
Yes. Fix profiler support for Ruby 4.0.0-preview2
Additional Notes:
N/A
How to test the change?
We don't yet have Ruby 4 in CI, so this can only be tested locally.