Skip to content
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-11475] Add extra safety checks when getting line number in profiler #4464

Merged

Conversation

ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Mar 6, 2025

What does this PR do?

This PR adds a few extra checks when getting the line number during stack trace gathering in the profiler.

We got one automated report of a crash in the rb_iseq_line_no function, and we couldn't reproduce it, so this is the first attempt at avoiding the issue -- let's see if we ever observe this crash again or not.

Motivation:

Improve stability of the profiler.

Change log entry
None.

Additional Notes:

See the internal PROF-11475 ticket for more details.

How to test the change?

Our existing test coverage already validates that stack trace gathering works fine and matches the Ruby APIs. If this condition was not correct, we'd get more lines set to 0, and our unit tests would fail. (I did some quick manual testing to check this was the case -- and indeed it is).

…iler

**What does this PR do?**

This PR adds a few extra checks when getting the line number during
stack trace gathering in the profiler.

We got one automated report of a crash in the `rb_iseq_line_no`
function, and we couldn't reproduce it, so this is the first attempt
at avoiding the issue -- let's see if we ever observe this crash again
or not.

**Motivation:**

Improve stability of the profiler.

**Additional Notes:**

See the internal PROF-11475 ticket for more details.

**How to test the change?**

Our existing test coverage already validates that stack trace gathering
works fine and matches the Ruby APIs. If this condition was not correct,
we'd get more lines set to 0, and our unit tests would fail. (I did some
quick manual testing to check this was the case -- and indeed it is).
@ivoanjo ivoanjo requested review from a team as code owners March 6, 2025 12:05
@github-actions github-actions bot added the profiling Involves Datadog profiling label Mar 6, 2025
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.69%. Comparing base (2f427f8) to head (1b1df1b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4464      +/-   ##
==========================================
- Coverage   97.70%   97.69%   -0.01%     
==========================================
  Files        1375     1375              
  Lines       83812    83812              
  Branches     4251     4251              
==========================================
- Hits        81887    81882       -5     
- Misses       1925     1930       +5     

☔ 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
Contributor

Datadog Report

Branch report: ivoanjo/prof-11475-add-extra-checks-when-calculating-line
Commit report: 1b1df1b
Test service: dd-trace-rb

✅ 0 Failed, 20428 Passed, 1369 Skipped, 3m 12.67s Total Time

@pr-commenter
Copy link

pr-commenter bot commented Mar 6, 2025

Benchmarks

Benchmark execution time: 2025-03-06 12:28:23

Comparing candidate commit 1b1df1b in PR branch ivoanjo/prof-11475-add-extra-checks-when-calculating-line with baseline commit 2f427f8 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 10faebc into master Mar 12, 2025
482 checks passed
@ivoanjo ivoanjo deleted the ivoanjo/prof-11475-add-extra-checks-when-calculating-line branch March 12, 2025 18:23
@github-actions github-actions bot added this to the 2.13.0 milestone Mar 12, 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.

3 participants