[fix][ml] Reset messageMetadataInitialized when recycling RangeCacheEntryWrapper - #25987
Merged
lhotari merged 1 commit intoJun 10, 2026
Merged
Conversation
…ntryWrapper The flag was never cleared on recycle, so any wrapper that had served a cache hit kept messageMetadataInitialized=true for every entry it was later reused for. getValueInternal then skipped the lazy initializeMessageMetadataIfNeeded call, and cache hits returned entries with null metadata, forcing each dispatcher to re-parse the message metadata per entry per subscription.
void-ptr974
approved these changes
Jun 10, 2026
dao-jun
approved these changes
Jun 10, 2026
lhotari
approved these changes
Jun 10, 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.
Motivation
RangeCacheEntryWrapper.recycle()resets all wrapper fields exceptmessageMetadataInitialized. Once a wrapper has served a cache hit (which sets the flag ingetValueInternal), every entry later stored in that recycled wrapper instance inheritsmessageMetadataInitialized=true, sogetValueInternal()skips the lazyEntryImpl.initializeMessageMetadataIfNeeded()call.After recycler warm-up, cache hits return entries whose message metadata was never parsed, and each dispatcher falls back to
Commands.peekAndCopyMessageMetadata— a full metadata parse plus aMessageMetadatacopy per entry per subscription. This silently defeats the parse-once-per-cached-entry optimization, with the cost multiplied by subscription fan-out.Modifications
Reset
messageMetadataInitializedinrecycle(), matching the reset of the other wrapper fields.recycle()is the wrapper's only return-to-pool path, so this fully restores the intended lazy-init behavior.