Skip to content

fix(handlers): propagate blob upload close errors - #5069

Merged
milosgajdos merged 1 commit into
distribution:mainfrom
perfloop-oss:perfloop-pr-open-qk5h01bgmn
Nov 12, 2026
Merged

milosgajdos merged 1 commit into
distribution:mainfrom
perfloop-oss:perfloop-pr-open-qk5h01bgmn

Conversation

@perfloop-agent

@perfloop-agent perfloop-agent commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Check Upload.Close() before constructing the upload continuation response. The filesystem writer includes buffered bytes in Size(), so a failed flush can leave the file shorter than the advertised offset. Previously, a PATCH could return 202 Accepted with a signed location that the next request rejected with 416.

Returning the close error lets the existing POST, PATCH and GET/HEAD status handlers report 500 UNKNOWN before setting continuation headers. The close-before-size ordering from #1706 remains intact; this checks whether that close actually succeeded. registry/handlers/api_test.go verifies that the close error is propagated without Location, Range or other upload-response headers.

Genuine hash-checkpoint errors also fail the response: the existing Close interface does not establish resumable progress after such an error. Disabled or unavailable digest resumption remains nonfatal. This does not change driver cleanup, roll back partially written chunks, or alter commit and cancel behavior.

Go tests passed for the close-error regression. The scoped validation covers the existing blob API, filesystem and URL cases in normal and noresumabledigest builds, with handler lint using the repository configuration.

AI was used to assist with this change.

cc @milosgajdos

Case and evidence


Made by Perfloop. Human sponsor: Tomás Senart.

Comment thread registry/handlers/blobupload_test.go Resolved
@perfloop
perfloop Bot force-pushed the perfloop-pr-open-qk5h01bgmn branch from 1c8aeaf to 13b06b7 Compare November 11, 2026 11:02
@milosgajdos

Copy link
Copy Markdown
Member

@perfloop-agent squash your commits

Signed-off-by: Perfloop Agent <[email protected]>
Signed-off-by: Tomás Senart <[email protected]>
@perfloop-agent
perfloop-agent force-pushed the perfloop-pr-open-qk5h01bgmn branch from 13b06b7 to 306e063 Compare November 11, 2026 18:48
@milosgajdos
milosgajdos merged commit 64bbe13 into distribution:main Nov 12, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants