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

Fix memory leak caused by not visiting the function in a CallValidator during gc #1100

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

dmontagu
Copy link
Collaborator

Fixes pydantic/pydantic#8239, I wouldn't be surprised if there was some connection to other memory issues we've noticed with ValidateCall (e.g., pydantic/pydantic#7687, though that one seemed to be addressed by doing a full garbage collection), either way this definitely seems like a bug.

@davidhewitt not sure if it makes sense to add tests of any sort for this, otherwise I think we can just merge.

Copy link

codecov bot commented Nov 29, 2023

Codecov Report

Merging #1100 (ee81c9f) into main (c7daf16) will increase coverage by 0.00%.
Report is 2 commits behind head on main.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1100   +/-   ##
=======================================
  Coverage   89.70%   89.70%           
=======================================
  Files         106      106           
  Lines       16359    16363    +4     
  Branches       35       35           
=======================================
+ Hits        14675    14679    +4     
  Misses       1677     1677           
  Partials        7        7           
Files Coverage Δ
src/validators/call.rs 98.11% <ø> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c7daf16...ee81c9f. Read the comment docs.

@dmontagu dmontagu changed the title Fix memory leak caused by not walking the function in a CallValidator Fix memory leak caused by not visiting the function in a CallValidator during gc Nov 29, 2023
Copy link

codspeed-hq bot commented Nov 29, 2023

CodSpeed Performance Report

Merging #1100 will not alter performance

Comparing dmontagu/fix-validate-call-memory-leak (ee81c9f) with main (5d64894)

Summary

✅ 140 untouched benchmarks

@davidhewitt
Copy link
Contributor

I think for the moment it's ok to not test this for now; I think in principle we could build a fuzzer which builds schemas and checks that they get garbage collected, but it'd be a lot of work. Maybe we could build something reusable for the PyO3 ecosystem sometime.

@davidhewitt davidhewitt merged commit f323e74 into main Nov 30, 2023
30 checks passed
@davidhewitt davidhewitt deleted the dmontagu/fix-validate-call-memory-leak branch November 30, 2023 09:45
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.

Memory leak caused by @validate_call decorator
2 participants