goharbor / harbor

An open source trusted cloud native registry project that stores, signs, and scans content.
https://goharbor.io
Apache License 2.0
23.76k stars 4.73k forks source link

failed to push image with >32GiB layers #19573

Closed gman0 closed 10 months ago

gman0 commented 10 months ago

Description

Pushing an image containing layers with size exceeding 32GiB fails.

Logs:

(full logs here)

registry Pod prints an error with unexpected EOF at contentLength=35444941962 copied=34359738368; 34359738368 bytes is exactly 32GiB, i.e. 1 << 35. I've tracked this down to:

https://github.com/goharbor/harbor/blob/v2.9.1/src/core/main.go#L131

Changing this value to 1111111111 confirms that the upload fails due to this limit:

time="2023-11-13T16:56:29.009795711Z" level=error msg="client disconnected during blob PUT" auth.user.name="harbor_registry_user" contentLength=1258698756 copied=1111111111 error="unexpected EOF" go.version=go1.21.3 http.request.contenttype="application/octet-stream" http.request.host="rvasek-registry-debug-h3g6j6gocomo-master-0.cern.ch:30003" http.request.id=8ce841de-8067-4bda-a899-9d5b16e46a56 http.request.method=PUT http.request.remoteaddr=10.100.132.0 http.request.uri="/v2/library/big-2/blobs/uploads/3a28357f-7774-4c1d-b81b-b2277a0ef56c?_state=Sn3--urLlCGtulvxOJbH_pvgsb7QvmO3kUJDlZp2u457Ik5hbWUiOiJsaWJyYXJ5L2JpZy0yIiwiVVVJRCI6IjNhMjgzNTdmLTc3NzQtNGMxZC1iODFiLWIyMjc3YTBlZjU2YyIsIk9mZnNldCI6MCwiU3RhcnRlZEF0IjoiMjAyMy0xMS0xM1QxNjo1NTo1NS4xNTgxNDgxMzlaIn0%3D&digest=sha256%3A9d0f378f076ea7045db9c04f5d574d85f5e3b6ed3be0f04f8a0fb564d7d31ef8" http.request.useragent="buildkit/v0.0-dev" vars.name="library/big-2" vars.uuid=3a28357f-7774-4c1d-b81b-b2277a0ef56c

Steps to reproduce the problem:

  1. Building and pushing the image:
    1. Generate data-33gib file:
      dd if=/dev/urandom of=data-33gib bs=1M count=33792 status=progress
    2. Dockerfile:
      FROM alpine:latest
      COPY data-33gib /data-33gib
      RUN ls -lh /data-33gib
    3. Build and push with buildctl:
      buildctl --debug build                                                                                                                                                            \
      --frontend dockerfile.v0                                                                                                                                                         \
      --local context=.                                                                                                                                                                \
      --local dockerfile=.                                                                                                                                                             \
      --output type=image,name=rvasek-registry-debug-h3g6j6gocomo-master-0.cern.ch:30003/library/big-1:latest,oci-mediatypes=true,compression=estargz,force-compression=true,push=true \
      --import-cache type=local,src=/image-import-cache                                                                                                                                \
      --export-cache type=local,dest=/image-export-cache
  2. Observe the push eventually fail (building the image with push=false succeeds)

Versions:

Additional context:

Our user needs to create an image of around 100GiB total -- copying an application directory with many files as a single layer. It is possible to work around the 32GiB limit by splitting the layer into multiple ones by having more COPY instructions. However, because the directory contains hard-links, the total size of the image increases by 50%.

chlins commented 10 months ago

Duplicate with https://github.com/goharbor/harbor/issues/18888.