Skip to content

Conversation

@ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented 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.

Change log entry

Yes. Disable heap profiling on Ruby 4 due to incompatibility

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 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.
@ivoanjo ivoanjo requested review from a team as code owners December 15, 2025 17:39
@github-actions
Copy link

github-actions bot commented Dec 15, 2025

Thank you for updating Change log entry section 👏

Visited at: 2025-12-16 00:05:54 UTC

@github-actions github-actions bot added the profiling Involves Datadog profiling label Dec 15, 2025
@datadog-official
Copy link

datadog-official bot commented Dec 15, 2025

✅ Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage
Patch Coverage: 100.00%
Overall Coverage: 95.25% (+0.00%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4076741 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

ivoanjo added a commit to DataDog/documentation that referenced this pull request Dec 15, 2025
…with Ruby 4

**What does this PR do?**

This PR pairs with DataDog/dd-trace-rb#5148 on
the Ruby profiler side to document that heap profiling is not
currently compatible with Ruby 4.

**Motivation:**

Document this limitation clearly, to avoid confusing customers.
@pr-commenter
Copy link

pr-commenter bot commented Dec 15, 2025

Benchmarks

Benchmark execution time: 2025-12-15 18:08:31

Comparing candidate commit 4076741 in PR branch ivoanjo/prof-13286-disable-heap-ruby-4 with baseline commit 8b6f012 in branch master.

Found 1 performance improvements and 1 performance regressions! Performance is the same for 42 metrics, 2 unstable metrics.

scenario:profiling - hold / resume

  • 🟩 throughput [+86899.118op/s; +93311.814op/s] or [+5.308%; +5.700%]

scenario:profiling - intern_all 1000 repeated strings

  • 🟥 throughput [-1494.948op/s; -1416.913op/s] or [-5.613%; -5.320%]

ivoanjo added a commit to DataDog/documentation that referenced this pull request Dec 16, 2025
…with Ruby 4 (#33363)

**What does this PR do?**

This PR pairs with DataDog/dd-trace-rb#5148 on
the Ruby profiler side to document that heap profiling is not
currently compatible with Ruby 4.

**Motivation:**

Document this limitation clearly, to avoid confusing customers.
@ivoanjo ivoanjo merged commit 8141e71 into master Dec 16, 2025
555 of 556 checks passed
@ivoanjo ivoanjo deleted the ivoanjo/prof-13286-disable-heap-ruby-4 branch December 16, 2025 09:08
@github-actions github-actions bot added this to the 2.24.0 milestone Dec 16, 2025
@Strech Strech mentioned this pull request Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

profiling Involves Datadog profiling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants