-
Notifications
You must be signed in to change notification settings - Fork 41
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 OOM bug #290
Fix OOM bug #290
Conversation
WalkthroughThe recent changes involve adding a Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (2)
go.mod
is excluded by:!**/*.mod
go.sum
is excluded by:!**/*.sum
Files selected for processing (2)
- chain/test_chain.go (1 hunks)
- fuzzing/fuzzer_worker.go (1 hunks)
Additional comments: 2
fuzzing/fuzzer_worker.go (1)
- 535-537: The addition of the defer statement to close the test chain object is a critical improvement for resource management, ensuring that resources are properly released to prevent memory leaks. This change directly addresses the OOM issue by ensuring the cache does not persist in memory unnecessarily.
chain/test_chain.go (1)
- 202-208: The implementation of the
Close
method correctly addresses the memory leak issue by resetting the stateDB trie's cache. This change is crucial for preventing OOM issues and aligns with best practices for resource management in Go.
There existed an OOM bug due to the use of go-ethereum stateDB trie's cache. This cache does not have an eviction policy and thus will persist in memory until explicitly reset or wiped through its API (see Limitations in the fastCache documentation).
Thus, any objects that reference this cache, the stateDB (which in turn means the
TestChain
), will never get wiped from the heap by Go's garbage collector.Note that we do not want to get rid of caching since it leads to magnitude improvements in throughput. Thus, the fix is two-fold:
medusa-geth
to have an exposed function that would allowmedusa
to directly reset the fast cache. See this commit.FuzzerWorker
is destroyed. This PR achieves that capability.This PR closes #249, #237 and #200.
Note that this PR should also lead to performance improvements for long-term medusa runs since memory consumption is now more efficient.
Summary by CodeRabbit