aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

Corrupted .tar.gz files after transfer (checksum related?)

Open darxmurf opened this issue 2 months ago • 7 comments

Describe the bug

Hi, I have a couple of .tar.gz files uploaded on a S3 server hosted in my university which are corrupted, or at least partially corrupted. Files uploaded from aws cli on a debian machine using

aws --endpoint-url=https://uni.server.tld s3 sync /my-folder/ s3://BUCKET-NR/archives/

When opening those files in a text editor, I can find a couple of lines containing 100000^M The ^M is a "DOS" carriage return in this case. There is one of those lines in the beginning of the file, then a few others later.

If I remove those lines, I can partially extract my archive but I still end with errors. After talking with the sysadmin in charge of the S3 server, he said the files got uploaded with aws-chuncked headers and I should re-upload them adding request_checksum_calculation = when_required in my conf.

But I don't have the original files anymore, so I need to find a way to fix those files. The curious point here is that I uploaded other files later and they look fine.

Is it aws client related or is there something wrong elsewhere? Thanks!

Regression Issue

  • [ ] Select this option if this issue appears to be a regression.

Expected Behavior

Smooth transfer without adding headers/content

Current Behavior

Files got transferred with added content

Reproduction Steps

can't reproduce

Possible Solution

No response

Additional Information/Context

No response

CLI version used

2.23.6

Environment details (OS name and version, etc.)

linux debian stable

darxmurf avatar Sep 30 '26 06:09 darxmurf

Here is a bit more info after a good amount of debug.

The added lines in the files are not always the same number. It's potentially a chunk size or something but some files got 100000 and other a string like 19a362.

The final result after digging with Claude (this is way out of my knowledge) is that some chunks of the files vanished on the way, resulting in files corruption. Claude generated an obscure python code that loop into the archive to scavenge what it can and create a list of "lost files". Depending the size of the archive, I have 10% of lost content.

But there is clearly a nasty bug here as a part of the files disappeared on the way and without any possibility to recover.

darxmurf avatar Sep 30 '26 16:09 darxmurf

Hey @darxmurf, when you say "a S3 server hosted in my university", do you mean an S3-compatible server that's not actually backed by AWS S3? Or is it actually backed by S3 on-prem (eg S3 Outposts)?

hssyoo avatar Sep 30 '26 17:09 hssyoo

Hey @darxmurf, when you say "a S3 server hosted in my university", do you mean an S3-compatible server that's not actually backed by AWS S3? Or is it actually backed by S3 on-prem (eg S3 Outposts)?

Hi, From what I know it's Scalitly hosted on prem. Don't have more details but I'll ask. Cheers

darxmurf avatar Oct 01 '26 10:10 darxmurf

Hey @darxmurf, when you say "a S3 server hosted in my university", do you mean an S3-compatible server that's not actually backed by AWS S3? Or is it actually backed by S3 on-prem (eg S3 Outposts)?

Hi, From what I know it's Scalitly hosted on prem. Don't have more details but I'll ask. Cheers

Thank you for clarifying this. That is a third-party S3-compatible service.

After talking with the sysadmin in charge of the S3 server, he said the files got uploaded with aws-chuncked headers and I should re-upload them adding request_checksum_calculation = when_required in my conf.

But I don't have the original files anymore, so I need to find a way to fix those files. The curious point here is that I uploaded other files later and they look fine.

Is it aws client related or is there something wrong elsewhere?

This sounds to me like the third-party service does not fully support aws-chunked. This seems to align with guidance found in https://github.com/scality/databricks-opensharing/blob/scality-1.4/docs/scality/README.md.

Therefore, I do not believe this is an issue within AWS CLI. The root cause of this issue is that the third-party S3-compatible service does not fully support the checksum features provided by S3.

I would also suggest the workaround suggested to opt out of request checksum calculation by default via request_checksum_calculation = when_required.

aemous avatar Oct 02 '26 20:10 aemous

This sounds to me like the third-party service does not fully support aws-chunked. This seems to align with guidance found in https://github.com/scality/databricks-opensharing/blob/scality-1.4/docs/scality/README.md.

Hi @aemous, Thanks for the links. Yep it's clearly linked with this checksum calculation thing but what "scares" me is the fact that you end up with corrupted data on the server. How is this possible. I could understand additional headers/data/other injected in the files but why did this process delete chunks?

darxmurf avatar Oct 04 '26 19:10 darxmurf

Yep it's clearly linked with this checksum calculation thing but what "scares" me is the fact that you end up with corrupted data on the server. How is this possible. I could understand additional headers/data/other injected in the files but why did this process delete chunks?

It might be worth cutting an issue to the third-party compatible service about that, they'll have a better understanding of their service's behavior.

I'm going to close this issue as there doesn't appear to be an issue with the AWS CLI, but please feel free to cut us a new issue if you experience an issue you can reproduce using just AWS S3.

RyanFitzSimmonsAK avatar Oct 19 '26 21:10 RyanFitzSimmonsAK

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.

github-actions[bot] avatar Oct 19 '26 21:10 github-actions[bot]