OCI pusher panics when reused for a second upload
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
Línea de trabajo
The issue identifies pkg/oci/pusher.go:212 and provides a reproducible regression test for pkg/oci/pusher_progress_test.go. Run the supplied go test -race -count=1 -timeout=45s -run '^TestPusher_Reuse$' ./pkg/oci command to see the failure. The issue says a focused fix and reuse/retry coverage are already being worked on, and links open pull request #4132.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Reusing one OCI Pusher for two uploads panics on the second upload. This affects callers that retain the pusher, including a functions.Client configured with WithPusher.
Reproduced on main at 56e770ff38205a4dd33c1595cac28e9f8d0e3e3b, Linux amd64, Go 1.27.3.
NewPusher allocates updates once. The pinned go-containerregistry closes that channel when remote.WriteIndex finishes, so the next upload receives the closed channel again.
Reproduce: add the test below as pkg/oci/pusher_progress_test.go, then run:
go test -race -count=1 -timeout=45s -run '^TestPusher_Reuse$' ./pkg/oci
Expected: both calls return the image-index digest. Actual: first push succeeds; second panics with close of closed channel in remote.(*progress).Close, called through pkg/oci/pusher.go:212. The regression failed locally (exit 1, package runtime 0.074s). It uses an empty OCI layout and an in-process test registry; no function build, external registry or Kubernetes cluster is needed.
Regression test
package oci
import (
"io"
"log"
"net/http/httptest"
"path/filepath"
"strings"
"testing"
"github.com/google/go-containerregistry/pkg/registry"
"github.com/google/go-containerregistry/pkg/v1/empty"
"github.com/google/go-containerregistry/pkg/v1/layout"
fn "knative.dev/func/pkg/functions"
)
// A client can reuse its pusher when a function is built and pushed again.
func TestPusher_Reuse(t *testing.T) {
server := httptest.NewServer(registry.New(registry.Logger(log.New(io.Discard, "", 0))))
t.Cleanup(server.Close)
f := fn.Function{Root: t.TempDir()}
f.Build.Image = strings.TrimPrefix(server.URL, "http://") + "/funcs/reuse:latest"
if _, err := layout.Write(filepath.Join(f.Root, fn.RunDataDir, fn.BuildDir, "oci"), empty.Index); err != nil {
t.Fatal(err)
}
want, err := empty.Index.Digest()
if err != nil {
t.Fatal(err)
}
pusher := NewPusher(true, true, false)
for i := 0; i < 2; i++ {
got, err := pusher.Push(t.Context(), f)
if err != nil {
t.Fatalf("push %d: %v", i+1, err)
}
if got != want.String() {
t.Fatalf("push %d: digest = %q, want %q", i+1, got, want)
}
}
}
I am working on a focused fix that gives each upload its own progress channel and drains it until the producer finishes, with reuse/retry coverage. No API, authentication, dependency or CI changes are proposed.
Prepared with Codex assistance. Tests reported above were actually run against unchanged production code. Full make test, make check and hosted CI have not run yet.
- Lenguaje dominante
- Go
- Estrellas
- 366
- Forks
- 231
- Merge medio
- 2 d 23 h
- PR fusionados (30 d)
- 50
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de knative/func
-
help wanted kind/good-first-issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
knative/func#4191 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Dificultad 3/5 1-2 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 2 días
-
MCP config_git_set exposes the GitHub token on the func subprocess command linePosiblemente ocupada @anjalirj27 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 30/100
Los mantenedores suelen responder en 2 días
-
Deprecation of legacy parliament Python functions (removal in 1.26)Posiblemente ocupada @gauron99 la tomó hace 4 días. Abiertokind/cleanup lifecycle/frozen
knative/func#4185 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Function CR sync should keep the spec fields func does not setPosiblemente ocupada @gauron99 la tomó hace 13 días. Abierto
knative/func#4156 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 2 días
Todos los issues de knative/func
Issues similares
-
[Bug]: gate 缺失Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
Generated cask uses deprecated `postflight` stanza; Homebrew 7 warns on every commandPosiblemente ocupada @k4kratik la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
sachincool/cruft#4 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
VictoriaMetrics/VictoriaLogs#1965 ·
Los mantenedores suelen responder en 1 día
-
kind/bug sig/ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
kubermatic/dashboard#8540 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
elastic/elastic-package#4249 ·
Los mantenedores suelen responder en 1 día