Manager startup spins after cancellation before cache readiness
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 57/100
Direzione di ricerca
Start with runnableGroup.Start and the cache startup call in (*controllerManager).Start, where the issue says cancellation leaves startup waiting for readiness. Use the reproduction in the issue to confirm the hang, then inspect readiness signaling and shutdown behavior around cancellation. Done when startup unwinds on cancellation, late readiness delivery cannot block or send to a closed channel, and deadline and runnable errors remain preserved.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Manager.Start can spin indefinitely when cancellation arrives before its cache readiness check succeeds. The wait in runnableGroup.Start handles ctx.Done() by recording a non-cancellation error, but never returns. If the cache readiness check returns false, that runnable never sends a readiness signal and the startup queue never empties. The deferred manager stop procedure is never reached.
This is reproducible with a real informer cache and no running API server. It also reproduces with a cache whose WaitForCacheSync explicitly returns false after cancellation. Both cases fail 3/3 with v0.25.0. A local source experiment that returns from the cancellation branch, removes the readiness-channel close, and makes readiness sends cancellation-aware passes both cases 3/3. The latter two changes prevent a late readiness callback from sending to a closed channel or blocking forever after startup returns.
The same cancellation loop is present in v0.25.2. The stack remains inside (*runnableGroup).Start.func1, called by (*controllerManager).Start at its cache startup step. Cancellation should let startup unwind and run the existing shutdown procedure, while preserving deadline and runnable errors.
Minimal reproduction (place in a Go module that requires sigs.k8s.io/controller-runtime v0.25.0 and matching Kubernetes dependencies, then run go test -v):
package cancellation_test
import (
"context"
"net/http"
"testing"
"time"
"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/meta"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/manager"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
)
func TestCancellationWithRealCache(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
scheme := runtime.NewScheme()
if err := corev1.AddToScheme(scheme); err != nil { t.Fatal(err) }
mapper := meta.NewDefaultRESTMapper([]schema.GroupVersion{corev1.SchemeGroupVersion})
mapper.Add(corev1.SchemeGroupVersion.WithKind("ConfigMap"), meta.RESTScopeNamespace)
opts := manager.Options{
Scheme: scheme,
LeaderElection: false,
BaseContext: func() context.Context { return ctx },
Logger: logr.Discard(),
Metrics: metricsserver.Options{BindAddress: "0"},
MapperProvider: func(*rest.Config, *http.Client) (meta.RESTMapper, error) {
return mapper, nil
},
}
mgr, err := manager.New(&rest.Config{Host: "http://127.0.0.1:1"}, opts)
if err != nil { t.Fatal(err) }
_, err = mgr.GetCache().GetInformer(ctx, &corev1.ConfigMap{}, cache.BlockUntilSynced(false))
if err != nil { t.Fatal(err) }
cancel()
done := make(chan error, 1)
go func() { done <- mgr.Start(ctx) }()
select {
case err := <-done:
if err != nil { t.Fatal(err) }
case <-time.After(time.Second):
t.Fatal("Manager.Start did not finish after cancellation with a real informer cache")
}
}
The one-second bound is only a regression guard. Increasing a manager shutdown deadline cannot resolve the infinite startup wait. No controller shutdown deadline, error filtering, or process termination change is needed to reproduce this.
Following CONTRIBUTING.md, reporting the proposed change here before opening a PR. Is returning from the startup cancellation branch with cancellation-aware readiness delivery the intended fix?
- Lingua principale
- Go
- Stelle
- 3k
- Fork
- 1.3k
- Merge medio
- 1g 7h
- PR unite (30g)
- 48
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di kubernetes-sigs/controller-runtime
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
kubernetes-sigs/controller-runtime#3704 ·
I maintainer di solito rispondono entro 1 giorno
-
lifecycle/rotten
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
kubernetes-sigs/controller-runtime#3537 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Read-your-writes consistency is not applied to unstructured objects written with Update or PatchForse già presa @7616e5a9c573ffb221843a498885ab0f l’ha presa 1 giorno fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 25/100
kubernetes-sigs/controller-runtime#3702 ·
I maintainer di solito rispondono entro 1 giorno
-
Client and DynamicRESTMapper keep a kind's old scope after its CRD is recreated with a different `scope`Forse già presa @AdamMagued l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
kubernetes-sigs/controller-runtime#3671 ·
I maintainer di solito rispondono entro 1 giorno
-
ReadYourWrite doesn't correctly deal with mutating requests removing the last finalizerForse già presa @AdamMagued l’ha presa 1 giorno fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 28/100
kubernetes-sigs/controller-runtime#3670 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di kubernetes-sigs/controller-runtime
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
OneBusAway/watchdog#470 ·
I maintainer di solito rispondono entro 1 giorno
-
area: session
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
charmbracelet/crush#4484 ·
I maintainer di solito rispondono entro 1 giorno
-
[Resource]: HearthApertaresource-submission validation-passed
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
hesreallyhim/awesome-claude-code#3713 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
expr-lang/expr#1037 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
provider-key submission
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
opentofu/registry#6740 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno