Assorted remote memory use fixes - #2789
Merged
Merged
Conversation
The `TooManyChunks` cap added in fed0321 was only checked inside the over-allocation branch of `Assembler::insert`, and only for the tail push. A peer sending many small gapped STREAM frames can keep over-allocation below the defragmentation threshold while the chunk count grows to the stream flow-control limit, and frames handled entirely by the unordered dedup loop return before the check runs. Either way the buffered chunk count is unbounded, which is the memory-exhaustion class the original advisory addressed. Check the chunk count after every push, including the unordered dedup loop, and compact once it passes a watermark above the cap so that a flood of mergeable (duplicate or contiguous) frames cannot force a defragmentation on every frame. A stream is rejected once compaction cannot bring the distinct span count back to the cap. Buffered chunks are bounded at O(twice the cap); the count is re-checked after every insert, though a single unordered frame may transiently push a few chunks past the watermark before that check.
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.
This rolls up several pending security advisories.