goharbor / acceleration-service

Provides a general service to support image acceleration based on kinds of accelerator like Nydus and eStargz etc.
Apache License 2.0
77 stars 27 forks source link

bug: gc clear blobs unexpeted #174

Closed Desiki-high closed 1 year ago

Desiki-high commented 1 year ago

Background

Gc will clear blobs by lease manager, lease manager will clear lease by lease cache. Lease will be updated in commit and read of each blob. When acceld work in multithread conversion with different jobs, some task can not find the blob locally.

time="2023-08-21T06:18:38.55829375Z" level=warning msg="failed to set containerd.io/uncompressed label for sha256:52d2b7f179e32b4cbd579ee3c4958027988f9a8274850ab0c7c24661e3adaac5" error="content digest sha256:52d2b7f179e32b4cbd579ee3c4958027988f9a8274850ab0c7c24661e3adaac5: not found"
time="2023-08-21T06:18:38.55838805Z" level=error msg="convert in worker: convert image: content digest sha256:fd9f026c631046113bd492f69761c3ba6042c791c35a60e7c7f3b8f254592daa: not found"

Reproduce

  1. boot acceld.
  2. prepare images.
  3. use accelctl create different tasks.
    images=("nginx" "alpine" "busybox")
    for image in ${images[@]}; do
    ./accelctl task create localhost/library/$image:latest
    done

    Reason

    When acceld converts multiple images with large size differences, for example : alpine and WordPress. Obviously alpine will finish the task first, and WordPress is still in the pulling phase. If alpine triggers gc(decide by configuration), GC will clear the blobs of WordPress because the lease of WordPress blob had cached in lease and only used once(in commit).