-
Notifications
You must be signed in to change notification settings - Fork 375
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
Conversation
See the huge comment for details :)
**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
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
BenchmarksBenchmark execution time: 2024-08-23 11:59:29 Comparing candidate commit f43b485 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 23 metrics, 2 unstable metrics. |
**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.
**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.
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);
inhttp_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