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

[release/2.8 backport] Ignore self reference object on empty prefix #4097

Closed
wants to merge 1 commit into from

Conversation

antoineco
Copy link

@antoineco antoineco commented Oct 11, 2023

Backport of the following PR to the release/2.8 branch:

(cherry-picked from commit 87cbd09)

Without this fix, the S3 backend causes the registry to crash immediately after starting PurgeUploads.
This affects downsteams like https://github.com/goharbor/harbor (which I am a user of, but not speaking for).

References:

When a given prefix is empty and we attempt to list its content AWS
returns that the prefix contains one object with key defined as the
prefix with an extra "/" at the end.

e.g.

If we call ListObjects() passing to it an existing but empty prefix,
say "my/empty/prefix", AWS will return that "my/empty/prefix/" is an
object inside "my/empty/prefix" (ListObjectsOutput.Contents).

This extra "/" causes the upload purging process to panic. On normal
circunstances we never find empty prefixes on S3 but users may touch
it.

Signed-off-by: Ricardo Maraschini <rmarasch@redhat.com>
Signed-off-by: Antoine Cotten <hello@acotten.com>
@milosgajdos
Copy link
Member

With https://github.com/distribution/distribution/releases/tag/v3.0.0-alpha.1 out I'm inclined to close this PR as it won't be merged into 2.x branch. All the further development are going into getting a stable v3 release out next year.

@antoineco antoineco closed this Dec 20, 2023
@antoineco antoineco deleted the backport-3302 branch December 20, 2023 09:48
@rkr-kununu
Copy link

For anyone bitten by this (and not wanting to upgrade to v3) you can add the env var (or configuration):

env:
  - name: REGISTRY_STORAGE_MAINTENANCE_UPLOADPURGING
    value: 'enabled: false'

This'll basically disable the "Upload Purging", which means the bug won't be trigger - but you'll also be suppressing the UploadPurging. However, I don't know if "Upload Purging" ever worked on S3.

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

Successfully merging this pull request may close these issues.

None yet

5 participants