Skip to content

Fix PutObject with CRT client chunkedEncodingEnabled(false)#7129

Merged
davidh44 merged 8 commits into
masterfrom
hdavidh/fix-crt-s3-put-chunkedEncodingEnabled-false
Jul 13, 2026
Merged

Fix PutObject with CRT client chunkedEncodingEnabled(false)#7129
davidh44 merged 8 commits into
masterfrom
hdavidh/fix-crt-s3-put-chunkedEncodingEnabled-false

Conversation

@davidh44

@davidh44 davidh44 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

S3 PutObject hangs indefinitely when using AwsCrtAsyncHttpClient with chunkedEncodingEnabled(false). Bug introduced in 2.30.0 when requestChecksumCalculation defaulted to WHEN_SUPPORTED, which triggers automatic checksum computation for PutObject. With chunked encoding disabled, the SDK buffers the payload into InMemoryPublisher to compute a header-based checksum. CRT's subscriber calls request(1) synchronously from within onNext() (legal per Reactive Streams spec), causing a re-entrant deadlock in InMemoryPublisher.fulfillDemand().

Modifications

  • InMemoryPublisher.fulfillDemand() — Fix re-entrant deadlock: return immediately on re-entrant call instead of spinning; outer do-while re-checks demand after releasing for multi-threaded safety.
  • InMemoryPublisher.request() — Validate n > 0 per Reactive Streams spec §3.9.

Testing

Added unit, integration, and TCK tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

License

  • I confirm that this pull request can be released under the Apache 2 license

@davidh44 davidh44 requested a review from a team as a code owner July 10, 2026 00:43
@joviegas

Copy link
Copy Markdown
Contributor

Can we scope this PR to just the root cause: the fix in InMemoryPublisher.fulfillDemand(), where a re-entrant request() call fails the sending compare-and-set and then spins forever instead of returning. That one change resolves the reported hang.

The other changes (FlexibleChecksummer ordering, contentLength propagation, the Content-Length/Transfer-Encoding fix in MakeAsyncHttpRequestStage) are independent fixes. Can we raise them as separate PRs so each is easy to review, test, and bisect if anything regresses?

@davidh44 davidh44 added this pull request to the merge queue Jul 13, 2026
Merged via the queue into master with commit dda8d0e Jul 13, 2026
13 of 14 checks passed
@github-actions

Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 13, 2026
@davidh44 davidh44 deleted the hdavidh/fix-crt-s3-put-chunkedEncodingEnabled-false branch July 13, 2026 22:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants