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

GCS storage: fails if object "docker/registry/v2/repositories/" exists #2975

Open
waldiTM opened this issue Aug 7, 2019 · 0 comments

Comments

@waldiTM
Copy link

commented Aug 7, 2019

Garbage collect and catalog lookup fail if a object called docker/registry/v2/repositories/ exists in the configured GCS bucket.

> [unrecovered-panic] runtime.fatalpanic() /usr/lib/go-1.11/src/runtime/panic.go:681 (hits goroutine(1):1 total:1) (PC: 0x4334a0)
Warning: debugging optimized function
Frame 3: $HOME/src/github.com/docker/distribution/registry/storage/catalog.go:132 (PC: b422e4)
   127: // with Walk to do handling with repositories in a storage.
   128: func handleRepository(fileInfo driver.FileInfo, root, last string, fn func(repoPath string) error) error {
   129:         filePath := fileInfo.Path()
   130:
   131:         // lop the base path off
=> 132:         repo := filePath[len(root)+1:]
   133:
   134:         _, file := path.Split(repo)
   135:         if file == "_layers" {
   136:                 repo = strings.TrimSuffix(repo, "/_layers")
   137:                 if lessPath(last, repo) {

GCS does not have support for folders. It emulates them by prefix search. If for some reason (using gsutil rsync to migrate data in my case) an object with the same name as the directory exists (docker/registry/v2/repositories/), it is returned. So the Walk function provides us with docker/registry/v2/repositories as root and the object docker/registry/v2/repositories. The object name is not longer as the root, causing the panic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.