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

Proxy cache serves the stale digests for the latest tags #19429

Closed
hoptical opened this issue Oct 10, 2023 · 9 comments · Fixed by #19801
Closed

Proxy cache serves the stale digests for the latest tags #19429

hoptical opened this issue Oct 10, 2023 · 9 comments · Fixed by #19801

Comments

@hoptical
Copy link

hoptical commented Oct 10, 2023

If you are reporting a problem, please make sure the following information are provided:

Expected behavior and actual behavior:
When a new image is pushed on the same tag (e.g., latest), the harbor proxy cache doesn't update to the latest digest and still serves the stale one. This behavior persists even when all artifacts are removed from the harbor panel unless the artifact record is deleted from Redis.

It's expected that Harbor serves the most recent digest for the same tag.

Steps to reproduce the problem:

  1. Create a project regarding the desired repository; ghcr here.
  2. Pull the repository: ghcr.io/snapp-incubator/snappcloud-hub-catalog:latest
  3. Push a new image with the latest tag
  4. Pull the image, and you will see that the previous digest is pulled.

Versions:
Please specify the versions of following systems.

  • harbor version: 2.7.0
  • docker engine version: 20.10.17
  • docker-compose version: 1.18.0

Additional context:

  • Harbor config files: harbor.yaml:
    hostname: xxx
    
    http:
     port: 80
    https:
       port: 443
       private_key: xxx
       certificate: xxx
    harbor_admin_password: xxx
    database:
     password: xxx
     max_idle_conns: 100
     max_open_conns: 1000
    data_volume: /data
    jobservice:
     max_job_workers: 10
    notification:
     webhook_job_max_retry: 10
    chart:
     absolute_url: disabled
    log:
     level: info
     local:
       rotate_count: 50
       rotate_size: 200M
       location: /var/log/harbor
    _version: 2.7.0
    proxy:
     http_proxy: xxx
     https_proxy: xxx
     no_proxy: xxx
     components:
       - core
       - registry
    
    metric:
     enabled: true
     port: 9090
     path: /metrics
    
    cache:
     # not enabled by default
     enabled: true
     # keep cache for one day by default
     expire_hours: 24
  • Log files: Attached; the desired digest is sha256:6920278b1beca46c117c655cdf7edd0932243f95620de35d0ea1e41d27c00335
    Screenshot from 2023-10-10 13-17-55
@MinerYang
Copy link
Contributor

MinerYang commented Oct 16, 2023

Hi @hoptical
Could you check the log if the latest image fetched from the remote repo? Otherwise, if the digest has already presents locally, the newest artifact not been pushed and UI would not updated.
Additional, could you please provide more logs of your harbor?

@stonezdj
Copy link
Contributor

stonezdj commented Oct 16, 2023

Harbor always serves the client with the latest image. except:

  1. The upstream registry is offline or has rate-limit setting
  2. Is it an image index? for the image index, its digest could be different from the original server because Harbor always proxies the image partially (eg: pull for a specific platform), and the digest in the proxy server differs from the original digest.

You should review the Harbor core log to see what is the process logic.

Copy link

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.

@github-actions github-actions bot added the Stale label Dec 16, 2023
@hoptical
Copy link
Author

Screenshot from 2023-10-10 13-17-55

@MinerYang @stonezdj Thanks for the following up. I have attached a screenshot of the logs of a stale artifact which Harbor keeps pulling even by deleting the record from Harbor registry UI. The real latest artifact is not pulled unless the below records are deleted from Redis:

"cache:manifestlist:ghcr/snapp-incubator/snappcloud-hub-catalog:latest"
"cache:manifestlist:ghcr/snapp-incubator/snappcloud-hub-catalog:latest:contenttype"

@stonezdj We haven't set any rate limit on the ghcr registry and as far as I know it's not an image index.

@github-actions github-actions bot removed the Stale label Dec 24, 2023
@stonezdj
Copy link
Contributor

Correct, it seems that the redis cache is not refreshed once the original server's image is changed.
"cache:manifestlist:ghcr/snapp-incubator/snappcloud-hub-catalog:latest"
"cache:manifestlist:ghcr/snapp-incubator/snappcloud-hub-catalog:latest:contenttype"

stonezdj pushed a commit to stonezdj/harbor that referenced this issue Dec 27, 2023
  fixes goharbor#19429

Signed-off-by: stonezdj <daojunz@vmware.com>
@stonezdj
Copy link
Contributor

stonezdj commented Dec 27, 2023

If pull with ctr, the error would like that

ERROR: failed to solve: xxx.xxx.xxx/dockerhub-proxy-cache/library/golang:1.21: 
failed to read expected number of bytes: unexpected EOF

@hoptical
Copy link
Author

hoptical commented Jan 2, 2024

@stonezdj I didn't get it. Is it now solved by your commit?

@stonezdj
Copy link
Contributor

stonezdj commented Jan 3, 2024

@stonezdj I didn't get it. Is it now solved by your commit?

Yes, fixed

@hoptical
Copy link
Author

hoptical commented Jan 3, 2024

@stonezdj I didn't get it. Is it now solved by your commit?

Yes, fixed

Thanks. Can we know about the release version In which the change is applied?

stonezdj pushed a commit to stonezdj/harbor that referenced this issue Jan 5, 2024
  fixes goharbor#19429

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj pushed a commit to stonezdj/harbor that referenced this issue Jan 10, 2024
  fixes goharbor#19429

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit that referenced this issue Jan 11, 2024
fixes #19429

Signed-off-by: stonezdj <daojunz@vmware.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
stonezdj pushed a commit to stonezdj/harbor that referenced this issue Jan 12, 2024
  fixes goharbor#19429

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj pushed a commit to stonezdj/harbor that referenced this issue Jan 12, 2024
  fixes goharbor#19429

Signed-off-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit that referenced this issue Jan 12, 2024
Cache image list with digest key

  fixes #19429

Signed-off-by: stonezdj <daojunz@vmware.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
stonezdj added a commit that referenced this issue Jan 15, 2024
Cache image list with digest key

  fixes #19429

Signed-off-by: stonezdj <daojunz@vmware.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
Vad1mo pushed a commit that referenced this issue Jan 26, 2024
* registryctl/api/registry/blob: fix dropped test error (#19721)

Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>

* Remove robot account update quota permission (#19819)

Signed-off-by: Yang Jiao <yang.jiao@broadcom.com>
Co-authored-by: Yang Jiao <yang.jiao@broadcom.com>

* Cache image list with digest key (#19801)

fixes #19429

Signed-off-by: stonezdj <daojunz@vmware.com>
Co-authored-by: stonezdj <daojunz@vmware.com>

* Add quota permissions testcase (#19822)

Signed-off-by: Yang Jiao <yang.jiao@broadcom.com>
Co-authored-by: Yang Jiao <yang.jiao@broadcom.com>

* deprecate gosec in makefile (#19828)

remove the unused the part from makefile

Signed-off-by: wang yan <wangyan@vmware.com>

* Add verification that robot account duration is not 0 (#19829)

Signed-off-by: Yang Jiao <yang.jiao@broadcom.com>

* fix artifact page bug (#19807)

* fix artifact page bug

* update testcase

* Upgrade to distribution (registry) v3 alpha

This includes all the benefits of the v3 distribution, but also all breaking changes.

Most notably, Image Manifest v2 Schema v1 support has been dropped, as well as the `oss` and `swift` storage drivers.

Currently, this still relies on v2's github.com/docker/distribution/registry/client/auth/challenge, because that code has been removed from the public API in v3.

Signed-off-by: Aaron Dewes <aaron.dewes@protonmail.com>

---------

Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
Signed-off-by: Yang Jiao <yang.jiao@broadcom.com>
Signed-off-by: stonezdj <daojunz@vmware.com>
Signed-off-by: wang yan <wangyan@vmware.com>
Signed-off-by: Aaron Dewes <aaron.dewes@protonmail.com>
Co-authored-by: Lars Lehtonen <lars.lehtonen@gmail.com>
Co-authored-by: Yang Jiao <72076317+YangJiao0817@users.noreply.github.com>
Co-authored-by: Yang Jiao <yang.jiao@broadcom.com>
Co-authored-by: stonezdj(Daojun Zhang) <stonezdj@gmail.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
Co-authored-by: Wang Yan <wangyan@vmware.com>
Co-authored-by: ShengqiWang <124650040+ShengqiWang@users.noreply.github.com>
altynbaev pushed a commit to altynbaev/harbor that referenced this issue Jan 29, 2024
fixes goharbor#19429

Signed-off-by: stonezdj <daojunz@vmware.com>
Co-authored-by: stonezdj <daojunz@vmware.com>
Signed-off-by: Altynbaev Dinislam <altynbayevdr@sberautotech.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants