fit get status issue#3755
fit get status issue#3755milosgajdos merged 1 commit intodistribution:mainfrom wy65701436:fix-getstatus
Conversation
Codecov ReportBase: 57.06% // Head: 57.05% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #3755 +/- ##
==========================================
- Coverage 57.06% 57.05% -0.01%
==========================================
Files 105 105
Lines 10806 10818 +12
==========================================
+ Hits 6166 6172 +6
- Misses 3952 3956 +4
- Partials 688 690 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
Looking through the logic of what happens if the connection drops and a client retries an upload of the same blob to the same location (including the state), where would that fail? I'm not sure if the state is checked earlier, but if not, it looks like the following would cancel the upload: distribution/registry/handlers/blobupload.go Lines 314 to 321 in d3d6014 Shouldn't that return a 416 with an updated Range and Location header instead, and not cancel the upload? |
|
In fact, according to this specification, https://github.com/distribution/distribution/blob/main/docs/spec/api.md#get-blob-upload, the client should have a way to get the upload offset through this API. However, according to the handler dispatcher, any get method with a UUID will be processed first by ResumeBlobUpload, which doesn't make much sense. 1, http servers should not cancel uploads while processing get methods, no matter what the case. |
|
The path I'm thinking of is:
I think you're implementing:
The risk I'm seeing with the retry is:
I can adjust the PATCH logic in my code to avoid any retries, but I think 416 would be a more appropriate response than a 404 to the retry. |
|
I think returning
That being said, this PR is headed in the right direction, just feel we should expand it? |
I agree that we should disable |
Yes, the PR certainly fixes an issue that needs to be fixed. So either expand or a separate PR would both be good. I picked 416 because it's defined in the spec and I think GHCR does this already. |
Personally, I'd also go for |
|
@milosgajdos @sudo-bmitch I've updated the code according to the about conversation, can you help to review it? |
|
Overall design looks right to me, but I'm not familiar enough with the code base. I'll make an intentionally broken client to do some testing. |
sudo-bmitch
left a comment
There was a problem hiding this comment.
Gave it a quick test and the changes LGTM.
1, return the right upload offset for client when asks. 2, do not call ResumeBlobUpload on getting status. 3, return 416 rather than 404 on failed to patch chunk blob. 4, add the missing upload close Signed-off-by: Wang Yan <wangyan@vmware.com>
milosgajdos
left a comment
There was a problem hiding this comment.
LGTM! @deleteriousEffect PTAL
1, return the right upload offset for client when asks.
2, do not call ResumeBlobUpload on getting status.
3, return 416 rather than 404 on failed to patch chunk blob.
4, add the missing upload close
Signed-off-by: Wang Yan wangyan@vmware.com