[VM] Fix cache inconsistency on interner limit overflow - #397
Open
fEst1ck wants to merge 2 commits into
Open
Conversation
Verify that exceeding any interner limit in check_ready flushes all caches together, since interned indices cross-reference between them. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
fEst1ck
requested review from
0xIcarus,
Primata,
areshand,
ganymedio and
musitdev
as code owners
July 15, 2026 16:19
areshand
approved these changes
Jul 29, 2026
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Ports upstream aptos-labs#18884 ([execution] Fix cache flush), making sure ty_tag_cache and struct_name_index_map are always flushed together.
ModuleCacheManager::check_readyused to flush each cache independently when its own interner limit was exceeded. The caches cross-reference each other through interned indices (type tags key onStructNameIndex, the module cache holds struct-name indices), so a partial flush could leave dangling or reused indices. Now exceeding any interner limit flushes all runtime-environment caches and the module cache together.Also adds a regression test (written independently, not copied from upstream).
How Has This Been Tested?
test_intern_pool_overflow_flushes_all_cachesincode_cache_global_manager.rs: for each of the four interner limits, populates every cache, trips just that limit, and asserts all caches are flushed together. Fails when the fix is reverted, passes with it.cargo test -p aptos-block-executor --lib code_cache_global_manager— 6 passed.Key Areas to Review
check_ready(code_cache_global_manager.rs): exceeding any of the four limits must flush everything, since a partial flush is what caused the inconsistency.RuntimeEnvironment/TypeTagCacheare gated behind#[cfg(any(test, feature = "testing"))], following the existing*_for_testconvention.Type of Change
Which Components or Systems Does This Change Impact?