fix(util-stream): handle backpressure in ChecksumStream#1869
Merged
kuhe merged 2 commits intosmithy-lang:mainfrom Feb 23, 2026
Merged
fix(util-stream): handle backpressure in ChecksumStream#1869kuhe merged 2 commits intosmithy-lang:mainfrom
kuhe merged 2 commits intosmithy-lang:mainfrom
Conversation
d4ab54f to
0c89953
Compare
0c89953 to
af10d84
Compare
af10d84 to
d5dcc1b
Compare
kuhe
approved these changes
Feb 23, 2026
Contributor
|
Thank you for your contribution of this fix. This fix is available in https://www.npmjs.com/package/@smithy/util-stream/v/4.5.13. This should be brought into your application(s) by running |
4 tasks
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 of changes:
Implemented proper backpressure handling in ChecksumStream.
Previously, the _write() method ignored when push() returned false (indicating the internal buffer reached highWaterMark), which led to uncontrolled memory growth when reads were slower than writes.
This change implements the deferred callback pattern: when push() returns false, we store the callback instead of calling it immediately. When downstream requests more data via _read(), we invoke the pending callback to resume upstream flow.
Backstory
I personally faced this issue while downloading large file from S3 to an ECS Fargate local disk (both in us-east-2). And at some point our service ran out of memory. There is also a related bug ticket for AWS SDK v3 opened by another user, but it was unfortunately closed due to an inability to reproduce the issue back then. From what I can tell, this appeared after
responseChecksumValidationwas set toWHEN_SUPPORTEDas the default for aws s3 sdk v3.How to reproduce:
I created a repository with an example

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.