-
Notifications
You must be signed in to change notification settings - Fork 426
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
fix(tracing): add flag for aiohttp that disables potential for memory leak #12081
fix(tracing): add flag for aiohttp that disables potential for memory leak #12081
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #12081 +/- ##
==========================================
- Coverage 12.98% 12.43% -0.56%
==========================================
Files 1607 1607
Lines 136979 136979
==========================================
- Hits 17782 17028 -754
- Misses 119197 119951 +754 ☔ View full report in Codecov by Sentry. |
|
Datadog ReportBranch report: ✅ 0 Failed, 98 Passed, 1378 Skipped, 3m 10.78s Total duration (30m 56.61s time saved) |
BenchmarksBenchmark execution time: 2025-02-04 19:29:31 Comparing candidate commit 0bb5b4e in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 394 metrics, 2 unstable metrics. |
I don't know the best place for this, but is it possible to put this in the aiohttp configuration docs somewhere: https://ddtrace.readthedocs.io/en/stable/integrations.html#id14, or the general "configuration" docs to call out the existence of this setting? |
Do we know why this is? Would weak refs for the finish callback be good enough? |
@brettlangdon no we don't know why and in my testing weak refs had the same effect of shortening the duration of the stream response span. This is essentially a mitigation for users. The next steps will be figuring out a way to not memory leak and also get span duration correct: https://github.com/DataDog/dd-trace-py/pull/12081/files#diff-dfa4245913c22bb0645a2e9a1b9ca2a0bf9db016b7920c4d07a3c112e66484afR139-R142 |
looking forward to a version with this option! |
9da136f
to
cf983ed
Compare
…ttp_flag_for_stream_response_time
is there any way we can get this update in 2.X version? We have some stuff built with internals. |
This PR adds the environment variable
DD_AIOHTTP_CLIENT_DISABLE_STREAM_TIMING_FOR_MEM_LEAK
to address a potential memory leak in the aiohttp integration. When set to true, this flag may cause streamed response span timing to be inaccurate. The flag defaults to false.When this was merged #7551 we essentially added support for getting the correct timing of streamed responses, however it also caused us to sometimes never close spans, which lead to a memory leak. When set to true, this flag essentially reverts that behavior.
Checklist
Reviewer Checklist