Skip to content

Add cache size monitoring to detect potential memory leaks#143

Merged
chrisguidry merged 2 commits intomainfrom
memory-leak-repro
Jun 24, 2025
Merged

Add cache size monitoring to detect potential memory leaks#143
chrisguidry merged 2 commits intomainfrom
memory-leak-repro

Conversation

@chrisguidry
Copy link
Owner

Summary

• Added CACHE_SIZE gauge metric to track global cache sizes that could grow unbounded
• Instrumented function signature, dependency parameter, and annotation caches
• Added memory leak reproduction script and psutil dependency for testing

This addresses issue #135 by providing monitoring capabilities to identify if global caches are the source of memory leaks during infinite retry scenarios with unique task parameters.

🤖 Generated with Claude Code

@github-actions
Copy link

github-actions bot commented Jun 24, 2025

📚 Documentation has been built for this PR!

You can download the documentation directly here:
https://github.com/chrisguidry/docket/actions/runs/15862506722/artifacts/3396455231

@codecov-commenter
Copy link

codecov-commenter commented Jun 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (819bfc9) to head (ed2f91f).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #143   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           28        28           
  Lines         3561      3570    +9     
  Branches       191       191           
=========================================
+ Hits          3561      3570    +9     
Flag Coverage Δ
python-3.12 100.00% <100.00%> (ø)
python-3.13 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/docket/annotations.py 100.00% <100.00%> (ø)
src/docket/dependencies.py 100.00% <100.00%> (ø)
src/docket/execution.py 100.00% <100.00%> (ø)
src/docket/instrumentation.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Added CACHE_SIZE gauge metric to track the size of global caches that could grow unbounded during infinite retry scenarios. Instrumented three key caches:
- Function signature cache (_signature_cache)
- Dependency parameter cache (_parameter_cache)
- Annotation cache (_cache)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@chrisguidry chrisguidry merged commit 51123de into main Jun 24, 2025
16 checks passed
@chrisguidry chrisguidry deleted the memory-leak-repro branch June 24, 2025 22:08
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