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

[NO-TICKET] Add more memory leak testing for profiling using asan #3864

Merged
merged 2 commits into from
Aug 23, 2024

Conversation

ivoanjo
Copy link
Member

@ivoanjo ivoanjo commented Aug 23, 2024

What does this PR do?

This PR builds atop the work from #3852 and #3862 to enable running the profiler test suite using the AddressSanitizer ("asan") tool (see https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer ).

This check will enable us to find bugs in the profiler that may not be otherwise caught.

Motivation:

Improve validation of the profiler native extension.

Additional Notes:

The "asan" tool is built into the clang compiler toolchain, and needs Ruby to be built with a special configuration.

The special configuration is not yet available in the upstream ruby/setup-ruby github action, so I needed to fork it and push a small tweak to make it available.

(The Ruby builds were added in ruby/ruby-dev-builder#10 ).

How to test the change?

Here's a passing CI run: https://github.com/DataDog/dd-trace-rb/actions/runs/10524502494/job/29161364590

I've also tested it by adding a memory leak (e.g. for instance commenting out ddog_Vec_Tag_drop(tags); in http_transport.c and confirmed the issue was flagged.

Here's the failing CI run: https://github.com/DataDog/dd-trace-rb/actions/runs/10524803685/job/29162274392

**What does this PR do?**

This PR builds atop the work from #3852 and #3862 to enable running
the profiler test suite using the AddressSanitizer ("asan") tool
(see https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer ).

This check will enable us to find bugs in the profiler that may not
be otherwise caught.

**Motivation:**

Improve validation of the profiler native extension.

**Additional Notes:**

The "asan" tool is built into the clang compiler toolchain, and
needs Ruby to be built with a special configuration.

The special configuration is not yet available in the upstream
`ruby/setup-ruby` github action, so I needed to fork it and push
a small tweak to make it available.

(The Ruby builds were added in
ruby/ruby-dev-builder#10 ).

**How to test the change?**

Here's a passing CI run:
https://github.com/DataDog/dd-trace-rb/actions/runs/10524502494/job/29161364590

I've also tested it by adding a memory leak (e.g. for instance
commenting out `ddog_Vec_Tag_drop(tags);` in `http_transport.c` and
confirmed the issue was flagged.

Here's the failing CI run:
https://github.com/DataDog/dd-trace-rb/actions/runs/10524803685/job/29162274392
@ivoanjo ivoanjo requested review from a team as code owners August 23, 2024 11:24
@github-actions github-actions bot added the profiling Involves Datadog profiling label Aug 23, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.85%. Comparing base (fe15909) to head (f43b485).

Additional details and impacted files
@@                       Coverage Diff                       @@
##           ivoanjo/fixes-from-asan-branch    #3864   +/-   ##
===============================================================
  Coverage                           97.85%   97.85%           
===============================================================
  Files                                1269     1269           
  Lines                               75868    75868           
  Branches                             3736     3736           
===============================================================
+ Hits                                74240    74244    +4     
+ Misses                               1628     1624    -4     

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

@pr-commenter
Copy link

pr-commenter bot commented Aug 23, 2024

Benchmarks

Benchmark execution time: 2024-08-23 11:59:29

Comparing candidate commit f43b485 in PR branch ivoanjo/profiler-asan-ci with baseline commit fe15909 in branch ivoanjo/fixes-from-asan-branch.

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

@ivoanjo ivoanjo added dev/testing Involves testing processes (e.g. RSpec) dev/ci Involves CircleCI, GitHub Actions, or GitLab dev/internal Other internal work that does not need to be included in the changelog labels Aug 23, 2024
Base automatically changed from ivoanjo/fixes-from-asan-branch to master August 23, 2024 13:51
@ivoanjo ivoanjo merged commit 708bf9b into master Aug 23, 2024
181 checks passed
@ivoanjo ivoanjo deleted the ivoanjo/profiler-asan-ci branch August 23, 2024 13:51
@github-actions github-actions bot added this to the 2.4.0 milestone Aug 23, 2024
ivoanjo added a commit that referenced this pull request Nov 7, 2024
**What does this PR do?**

This PR re-enables the memory leak testing using the asan tool job in
CI.

For context, we added this testing in #3864 (more details about what
asan is can be found in that PR), but had to disable it in #3915
as the upstream Ruby builds we were using were broken and unavailable
for a while.

This has since been fixed upstream, and so let's re-enable this CI job.

In fact, upstream now officially allows these builds to be used, so
we no longer even need our fork of `setup-ruby` to enable them.

**Motivation:**

Improve our testing for native memory leaks.

**Additional Notes:**

N/A

**How to test the change?**

Validate that the "test-asan" is now running in CI.
ivoanjo added a commit that referenced this pull request Nov 7, 2024
**What does this PR do?**

This PR re-enables the memory leak testing using the asan tool job in
CI.

For context, we added this testing in #3864 (more details about what
asan is can be found in that PR), but had to disable it in #3915
as the upstream Ruby builds we were using were broken and unavailable
for a while.

This has since been fixed upstream, and so let's re-enable this CI job.

In fact, upstream now officially allows these builds to be used, so
we no longer even need our fork of `setup-ruby` to enable them.

**Motivation:**

Improve our testing for native memory leaks.

**Additional Notes:**

N/A

**How to test the change?**

Validate that the "test-asan" is now running in CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev/ci Involves CircleCI, GitHub Actions, or GitLab dev/internal Other internal work that does not need to be included in the changelog dev/testing Involves testing processes (e.g. RSpec) profiling Involves Datadog profiling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants