Skip to content
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

Wrong chunking of parts when uploading to S3 #3205

Open
incubos opened this issue Jul 16, 2020 · 3 comments
Open

Wrong chunking of parts when uploading to S3 #3205

incubos opened this issue Jul 16, 2020 · 3 comments

Comments

@incubos
Copy link

incubos commented Jul 16, 2020

Docker Registry 2.7.0 with S3 storage backend chunkSize set to 32MB:

...
storage:
    s3: 
        ...
        chunksize: 33554432

When pushing a ≈70MB layer to the registry it is split into 32MB and ≈38MB parts which doesn't respect chunkSize configuration. Here are the intercepted part upload HTTP requests, please, focus on Content-Length headers:

// Part 1 (OK)
PUT /******/_uploads/e291fc4d-b670-4f7b-aa47-76ec637918ff/data?partNumber=1&uploadId=68c1a260-c6a7-11ea-a23b-a50eac241fcb HTTP/1.1
Host: ******
User-Agent: aws-sdk-go/1.15.11 (go1.11.6; linux; amd64)
Content-Length: 33554432
...

// Part 2 (not OK)
PUT /******/_uploads/e291fc4d-b670-4f7b-aa47-76ec637918ff/data?partNumber=2&uploadId=68c1a260-c6a7-11ea-a
23b-a50eac241fcb HTTP/1.1
Host: ******
User-Agent: aws-sdk-go/1.15.11 (go1.11.6; linux; amd64)
Content-Length: 38611098
...
@milosgajdos
Copy link
Member

@incubos can you verify if this is broken on main branch which is a candidate for v3?

@incubos
Copy link
Author

incubos commented Dec 18, 2023

@incubos can you verify if this is broken on main branch which is a candidate for v3?

Could you please reference a commit containing the fix for the issue?
Unfortunately, I will not be able to verify in near future. Maybe someone else is able to?

@milosgajdos
Copy link
Member

I havent dived into this properly. I was reviewing some open issues and asking the reporters to check on their side.

There have been a lot of updates in the past 3 years across multiple storage drivers. Now as for your question:

When pushing a ≈70MB layer to the registry it is split into 32MB and ≈38MB parts which doesn't respect chunkSize configuration.

This is the current behaviour of the S3 storage driver -- the last chunk is combined into the chunk that's about to be "flushed" to S3:

if _, err := buf.Write(w.pending.data); err != nil {

This isn't going to change anytime soon, alas there has been some recent discussion around this issue that cropped up recently #3940

So let's keep this open until there is some "fix"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants