OCI pusher panics when reused for a second upload
メンテナーはふだん 2 日以内に返信
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Go
- スター
- 366
- フォーク
- 231
- 平均マージ
- 2日 23時間
- マージ済み PR(30日)
- 50
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
knative/func のほかの issue
-
help wanted kind/good-first-issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
knative/func#4191 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
メンテナーはふだん 2 日以内に返信
-
MCP config_git_set exposes the GitHub token on the func subprocess command line対応中かも @anjalirj27 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 30/100
メンテナーはふだん 2 日以内に返信
-
Deprecation of legacy parliament Python functions (removal in 1.26)対応中かも @gauron99 が 4 日前に担当しました。 オープンkind/cleanup lifecycle/frozen
knative/func#4185 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
Function CR sync should keep the spec fields func does not set対応中かも @gauron99 が 13 日前に担当しました。 オープン
knative/func#4156 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
似ている issue
-
[Bug]: gate 缺失オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
Generated cask uses deprecated `postflight` stanza; Homebrew 7 warns on every command対応中かも @k4kratik が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sachincool/cruft#4 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
VictoriaMetrics/VictoriaLogs#1965 ·
メンテナーはふだん 1 日以内に返信
-
kind/bug sig/ui
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
kubermatic/dashboard#8540 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
elastic/elastic-package#4249 ·
メンテナーはふだん 1 日以内に返信