Skip to content

[PROF-11809] Fix profiler compatibility with ruby-head (3.5)#4656

Merged
ivoanjo merged 1 commit into
masterfrom
ivoanjo/prof-11809-fix-ruby-35-compatibility
May 16, 2025
Merged

[PROF-11809] Fix profiler compatibility with ruby-head (3.5)#4656
ivoanjo merged 1 commit into
masterfrom
ivoanjo/prof-11809-fix-ruby-35-compatibility

Conversation

@ivoanjo

@ivoanjo ivoanjo commented May 16, 2025

Copy link
Copy Markdown
Member

What does this PR do?

This PR fixes three issues in the profiler when used with latest ruby-head:

  1. It's no longer possible to ask the object_id from a T_IMEMO object. This showed up as a Ruby VM crash with an error message "T_IMEMO can't have an object_id". (See Ensure shape_id is never used on T_IMEMO ruby/ruby#13347 for the upstream change)

  2. Creating new instances of a class is now inlined into the caller, and there is no longer a frame to represent the new. This broke some of our tests that expected the stack from allocating an object to have the new at the top. (See Inline Class#new. ruby/ruby#13080 for the upstream change)

  3. Object ids now count towards the size of objects. This broke some of our tests that asserted on size of profiled objects. (See Move object_id in attributes ruby/ruby#13159 for the upstream change)

Motivation:

Fix support for Ruby 3.5.

Change log entry

Yes. Fix profiler compatibility with ruby-head (3.5)

Additional Notes:

N/A

How to test the change?

I've updated our specs to cover these changes. Unfortunately, we don't yet test with Ruby 3.5 in CI, so you'll have to test manually if you want to see the fixes working with 3.5.

(Note that these changes showed up after 3.5.0-preview1, so testing on -preview1 is not enough)

**What does this PR do?**

This PR fixes three issues in the profiler when used with latest
ruby-head:

1. It's no longer possible to ask the object_id from a T_IMEMO object.
   This showed up as a Ruby VM crash with an error message
   "T_IMEMO can't have an object_id".
   (See ruby/ruby#13347 for the upstream change)

2. Creating new instances of a class is now inlined into the caller,
   and there is no longer a frame to represent the new.
   This broke some of our tests that expected the stack from
   allocating an object to have the `new` at the top.
   (See ruby/ruby#13080 for the upstream change)

3. Object ids now count towards the size of objects.
   This broke some of our tests that asserted on size of profiled
   objects.
   (See ruby/ruby#13159 for the upstream change)

**Motivation:**

Fix support for Ruby 3.5.

**Additional Notes:**

N/A

**How to test the change?**

I've updated our specs to cover these changes. Unfortunately, we don't
yet test with Ruby 3.5 in CI, so you'll have to test manually if you
want to see the fixes working with 3.5.

(Note that these changes showed up after 3.5.0-preview1, so testing
on -preview1 is not enough)
@ivoanjo
ivoanjo requested review from a team as code owners May 16, 2025 09:29
@github-actions github-actions Bot added the profiling Involves Datadog profiling label May 16, 2025
@codecov-commenter

codecov-commenter commented May 16, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.76%. Comparing base (209bb9a) to head (5a10acb).
⚠️ Report is 2671 commits behind head on master.

Files with missing lines Patch % Lines
...filing/collectors/cpu_and_wall_time_worker_spec.rb 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4656      +/-   ##
==========================================
- Coverage   97.77%   97.76%   -0.02%     
==========================================
  Files        1422     1422              
  Lines       86712    86718       +6     
  Branches     4403     4405       +2     
==========================================
- Hits        84783    84778       -5     
- Misses       1929     1940      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-datadog-prod-us1

Copy link
Copy Markdown
Contributor

Datadog Report

Branch report: ivoanjo/prof-11809-fix-ruby-35-compatibility
Commit report: 5a10acb
Test service: dd-trace-rb

✅ 0 Failed, 21049 Passed, 1372 Skipped, 3m 52.67s Total Time

@pr-commenter

pr-commenter Bot commented May 16, 2025

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2025-05-16 09:51:43

Comparing candidate commit 5a10acb in PR branch ivoanjo/prof-11809-fix-ruby-35-compatibility with baseline commit 209bb9a in branch master.

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

@ivoanjo
ivoanjo merged commit ca354d6 into master May 16, 2025
@ivoanjo
ivoanjo deleted the ivoanjo/prof-11809-fix-ruby-35-compatibility branch May 16, 2025 09:53
@github-actions github-actions Bot added this to the 2.16.0 milestone May 16, 2025
@Strech Strech mentioned this pull request May 19, 2025
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.

4 participants