-
Notifications
You must be signed in to change notification settings - Fork 865
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 Breaking Change - 3.7.412.0+ doesn't respect seekable streams and incorrectly sets Content-Length Header #3629
Comments
There was a change in version 3.7.412.0, described in one of the announcements pinned to this repo: #3610 Are you using S3 or a 3rd-party implementation? |
I'm using S3, tests run against localstack (latest) |
That announcement I didn't know about it, but even reading it doesn't know how it would apply to anything I do (pointing out the messaging may need work). You don't seek the the start of the stream and this scenario should just work. It seems like a bug with how you are setting the header. The content I'm sending is expected, I don't want to have to allocate and buffer a memory streams just so the library sets the correct header length. |
My full test is asserting I can save partial content based on stream position. We have in various storage providers and they all allows this:
|
We were able to reproduce it when using S3 too and are investigating it. We do have a test that seeks a stream before uploading an object, trying to verify what we missed there:
|
Could it be something with PutObject vs PutObjectAsync and or chunk encoding? I don't think that would matter? Also, I noticed you could speed up your tests by moving |
No, I don't believe so. I tried your sample code without disabling chunk encoding and it still failed. One odd thing I found out so far is that I don't see the error when using the .NET Framework (which is the target that integration test I linked uses). But it does happen consistently in .NET 8 |
@niemyjski / @dscpinheiro I'm getting a different error though with the latest version of It's working in My project is targeting |
@niemyjski I put up a PR to address this issue (#3631); your suggestion was correct, we had an implementation specific for .NET Standard / .NET 8 that was not taking into account the stream position when setting the header. It's pending approvals, but hopefully it'll be included in our next release. For the moment, you can keep using a version newer than @ashishdhingra |
Awesome job! Any idea why the entire test suite isn't running across all TFMs? |
Describe the bug
I've tracked it down to this was working in 3.7.411.7 but broken in any future release. Due to how you tag releases and different client versions it's pretty hard to track down...
Regression Issue
Expected Behavior
I should be able to post a partial stream.
Current Behavior
Crashes with an error
System.Net.Http.HttpRequestException
Sent 298 request content bytes, but Content-Length promised 305.
Reproduction Steps
Possible Solution
Set the content length header to stream length - stream position instead of stream length
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
AWSSDK.S3 3.7.412.0 +
Targeted .NET Platform
.NET Core 8
Operating System and version
Mac Os
The text was updated successfully, but these errors were encountered: