Skip to content

[CLIENT-3915] Reduce the number of reported stack traces for leaks by only showing definite leaks. This makes it easier to create a suppressions file that isn't too large.#1097

Draft
juliannguyen4 wants to merge 11 commits into
devfrom
CLIENT-3915-add-suppression-that-ignores-all-possibly-lost-or-reachable-stack-traces-without-client-lines
Draft

[CLIENT-3915] Reduce the number of reported stack traces for leaks by only showing definite leaks. This makes it easier to create a suppressions file that isn't too large.#1097
juliannguyen4 wants to merge 11 commits into
devfrom
CLIENT-3915-add-suppression-that-ignores-all-possibly-lost-or-reachable-stack-traces-without-client-lines

Conversation

@juliannguyen4

@juliannguyen4 juliannguyen4 commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

Only show definite leaks to reduce the number of suppressions we need to save. When running python3 -c "1" installed with valgrind, PYTHONMALLOC=malloc, and the default suppressions file in the python/cpython repo, most of the false positive leaks are categorized as "possibly lost" and a few are "reachable". I believe memory leaks are more likely to happen in the Python client because of "definitely lost" leaks; I don't think that the client code usually moves pointers of heap allocated memory to point somewhere in between that section, which would lead to "possibly lost" leaks.

I also don't believe reachable leaks would usually lead to an out of memory error since there's still a reference to those memory allocations.

There is an alternate PR for this ticket that attempts to create a suppressions file with all the "possibly lost" and "reachable" leaks found from running the dev tests, but that file is extremely large. #881

Extra changes

Always generate suppressions in case new ones needs to be added to the existing suppressions

TODO

  • Add appropriate copyright notices for valgrind suppressions file
  • There is a risk these suppressions can cause false negatives

… to save. When running Python with valgrind, PYTHONMALLOC=malloc, and the default suppressions file in python/cpython, most of the false positive leaks are possibly lost and a few are reachable. I believe memory leaks are more likely to happen in the Python client with definitely lost leaks; I don't think the client moves the pointer to heap allocated memory that much, which would lead to possibly lost leaks. Also I don't believe reachable leaks would usually lead to an out of memory error.
@codecov-commenter

codecov-commenter commented Jun 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.46%. Comparing base (90a0873) to head (8568622).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #1097   +/-   ##
=======================================
  Coverage   84.46%   84.46%           
=======================================
  Files          99       99           
  Lines       14090    14090           
=======================================
  Hits        11901    11901           
  Misses       2189     2189           

☔ View full report in Codecov by Harness.
📢 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.

…ssion-that-ignores-all-possibly-lost-or-reachable-stack-traces-without-client-lines
…ssion-that-ignores-all-possibly-lost-or-reachable-stack-traces-without-client-lines
…run valgrind multiple times to see if these suppressions are good enough to generate a stable baseline.
@juliannguyen4 juliannguyen4 changed the title [CLIENT-3915] Reduce the number of reported stack traces for leaks in the valgrind logs. This should make it easier to create a suppressions file that isn't too large. [CLIENT-3915] Reduce the number of reported stack traces for leaks by only showing definite leaks. This makes it easier to create a suppressions file that isn't too large. Jun 23, 2026
@juliannguyen4

juliannguyen4 commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

Manual testing

  • Valgrind now passes 5 times with the suppressions file and with errors enabled for definite leaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants