Bound Thunder Thrift containers before allocation - #28
Open
garagon wants to merge 1 commit into
Open
Conversation
garagon
force-pushed
the
codex/lazy-thrift-container-allocation
branch
from
August 13, 2026 23:21
1ec74c5 to
81eb666
Compare
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.
Summary
Keep legacy Thrift event decoding from reserving memory based only on a container count declared in the payload.
Thunder's generated readers preallocate vectors from the decoded list length. Apache Thrift's default configuration limits total message size, but it has no container-element limit and does not bind that check to the bytes in the current payload. In the unmodified code, an 11-byte event declaring 1,000,000 strings reaches
Vec::with_capacityand requests a 24 MB allocation before the first string read fails.Both legacy deserializers now use Thrift's built-in
TConfiguration:read_list_begin, before generated code preallocates the vectorThe protobuf v2 path and generated schema files are unchanged. A legacy event containing a collection above 100,000 elements will now be rejected.
This applies to messages consumed by Thunder's Kafka listeners. It does not imply that the topic is publicly writable; reachability depends on Kafka producer access.
Validation
TweetEventcontaining one string still deserializes correctly.rustfmt --checkpasses.The public repository does not include a build manifest for
thunder, so a full service build is not available from this checkout.