[PROF-13115] Re-enable heap profiling on Ruby 4.0#5121
Merged
Conversation
Ruby 3.5.0 will never exist and has been renamed to 4.0.0.
…incompatibility" This reverts commit 662eed8. The upstream bug has been fixed so we'll add a 4.0.0preview2-specific skip for CI but no need to fuse off heap profiling in the release itself since we know 4.0.0 is expected to work fine again.
We still have 4.0.0preview2 in CI (which we don't want to break) but the issue is fixed in master + I've locally validated it so we just need to keep CI happy until we get rid of 4.0.0preview2.
Strech
approved these changes
Dec 9, 2025
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage 🔗 Commit SHA: 978c774 | Docs | Datadog PR Page | Was this helpful? Give us feedback! |
y9v
approved these changes
Dec 9, 2025
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 is a revert of #5090 + with a few extra cleanups of code that referenced Ruby 3.5, updating it to reference Ruby 4/4.0.
Motivation:
In #5090 we disabled heap profiling on Ruby 4 due to https://bugs.ruby-lang.org/issues/21710 because we weren't sure of when the issue would be fixed (either upstream or with extra work on our side).
It turns out that upstream made a very speedy fix, so we don't need to disable this feature anymore -- I've tested with current ruby-head and it works fine again.
Change log entry
None. (We never released #5090.)
Additional Notes:
Because CI is not on ruby-head, and is still on 4.0.0preview2 where the issue still happens, I've kept a skip for the heap profiling specs for that version.
While I was searching for other 3.5 references, I spotted a bunch in the codebase so I ended up updating those too. I've separated out the changes into commits so they can be reviewed separately if needed.
How to test the change?
CI is green + run profiler specs on latest ruby-head and validate it's still green.