[PROF-13115] Fix profiler support for Ruby 4.0.0-preview2#5091
Merged
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! |
Merged
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
approved these changes
Nov 25, 2025
Merged
ivoanjo
added a commit
that referenced
this pull request
Dec 15, 2025
**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.
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.
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.