Fix ResponseDataStream small-buffer reads#457
Conversation
Brownian Motion (Brass)Recommendation: Refactor Summary: PR addresses data loss in ResponseDataStream; approach is sound but complex. Highlights
Unknowns
Next actions
Reflection questions
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughFixes the ChangesAsyncRead Stream Preservation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 4/8 reviews remaining, refill in 28 minutes and 57 seconds.Comment |
acf4aa1 to
d106d33
Compare
Brownian Motion (Brass)Recommendation: Refactor Summary: PR addresses data loss in small-buffer reads, but complexity may outweigh benefits. Highlights
Unknowns
Next actions
Reflection questions
|
|
Thanks for the data-integrity fix. The previous Verification before merge:
Merging this as the fix for #437. |
Linked issue: Fixes #437
Problem
ResponseDataStreamimplemented TokioAsyncReadand async-stdReadby copying only the bytes that fit in the caller-provided buffer from each stream chunk. If a stream chunk was larger than the read buffer, the unread tail of that chunk was dropped, causing data loss for small-buffer consumers.Solution
When a chunk is larger than the caller buffer, preserve the unread tail by re-inserting it at the front of the boxed byte stream before continuing with the original stream. This keeps the existing
ResponseDataStream::bytes()API and public struct fields intact while fixing both Tokio and async-std read implementations.Focused verification
cargo test -p rust-s3 --no-default-features --features tokio-native-tls request::request_trait::tests::test_async_read -- --nocapture— passed: 4 passed, 0 failed.cargo test -p rust-s3 --no-default-features --features async-std-native-tls request::request_trait::async_std_tests::test_async_read -- --nocapture— passed: 4 passed, 0 failed.Risk notes
Low-to-moderate risk area because this touches streaming read semantics. The change is intentionally scoped to
ResponseDataStreamread adapters and does not alter request construction, signing, credentials, provider selection, TLS, orResponseDataStream::bytes().Provider/runtime cordons
This change is
Summary by CodeRabbit
Bug Fixes
Tests