This repository was archived by the owner on Jan 20, 2026. It is now read-only.
Fix memory leak due to emitting infinite events during snapshot#391
Merged
Fix memory leak due to emitting infinite events during snapshot#391
Conversation
yzang2019
commented
Jan 3, 2024
| // If parent is invalid, get the cache value. | ||
| if !iter.parent.Valid() { | ||
| value := iter.cache.Value() | ||
| iter.eventManager.EmitResourceAccessReadEvent("iterator", iter.storeKey, iter.cache.Key(), value) |
Collaborator
Author
There was a problem hiding this comment.
These events are causing memory leak during snapshot creation, it should be safe to delete since those events are not being used in critical path at all
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #391 +/- ##
==========================================
- Coverage 54.80% 54.79% -0.01%
==========================================
Files 622 622
Lines 52168 52166 -2
==========================================
- Hits 28590 28585 -5
- Misses 21495 21498 +3
Partials 2083 2083
|
codchen
approved these changes
Jan 9, 2024
yzang2019
added a commit
that referenced
this pull request
Jan 17, 2024
codchen
pushed a commit
that referenced
this pull request
Feb 6, 2024
masih
pushed a commit
to sei-protocol/sei-chain
that referenced
this pull request
Sep 29, 2025
## Describe your changes and provide context This PR reverts the change in sei-protocol/sei-cosmos#353 and sei-protocol/sei-cosmos#391 until we have OCC fully enabled. ## Testing performed to validate your change Unit test coverage
masih
pushed a commit
to sei-protocol/sei-chain
that referenced
this pull request
Sep 30, 2025
## Describe your changes and provide context This PR reverts the change in sei-protocol/sei-cosmos#353 and sei-protocol/sei-cosmos#391 until we have OCC fully enabled. ## Testing performed to validate your change Unit test coverage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes and provide context
Problem:
Currently when the wasmd snapshotter export snapshot, it will create a CacheMultiStore and use cachekv to access the historical state, which will then create a mergeIterator to iterate through key/values. In MergeIterator, everytime we access a key or value, it will emit a resource access events for "iterate" operation, but there's no limit on how many events to be emitted, so as we append more and more events to event manager during wasm snapshot, it starts to fill up the memory.
Solution:
We can completely get rid of this iterator events, that event is not useful at all.
Testing performed to validate your change
Tested and validated on atlantic-2