[Bug]: Instance manager scans PluginSocketDir only once at startup; a sidecar plugin socket appearing seconds later is permanently missed
I maintainer di solito rispondono entro 1 giorno
@somaz94 ci sta già lavorando.
Dal 24/11/2026.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go, kubernetes, postgresql
- Ambito
- backend, infrastructure
Direzione di ricerca
Start at the one-shot scan in internal/cmd/manager/instance/run/cmd.go:264-285 and follow how availablePluginNames is passed into metrics.NewPluginCollector and controller.NewInstanceReconciler. Then read the enabled-plugin intersection in internal/management/controller/instance_controller.go:151-157 and the plugin repository's RegisterUnixSocketPluginsInPath implementation. Reproduce with a sidecar socket created after the postgres container starts; done means an enabled plugin socket appearing later in /plugins is discovered without restarting the container.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing issue already for this bug?
- I have searched for an existing issue, and could not find anything. I believe this is a new bug.
I have read the troubleshooting guide
- I have read the troubleshooting guide and I think this is a new bug.
I am running a supported version of CloudNativePG
- I am running a supported version of CloudNativePG.
Version
1.30.1 / 1.30.2 with plugin-barman-cloud v0.15.0; verified on main at e9eec0d as well
What version of Kubernetes are you using?
1.35.7
What is your Kubernetes environment?
Cloud: Azure AKS (with Kata Pod Sandboxing / KataVmIsolation)
How did you install the operator?
Helm
What happened?
The instance manager scans PluginSocketDir (/plugins) only once at process startup (internal/cmd/manager/instance/run/cmd.go:264-285):
pluginRepository := repository.New()
availablePluginNames, err := pluginRepository.RegisterUnixSocketPluginsInPath(
configuration.Current.PluginSocketDir,
)
That one-shot availablePluginNames slice is captured permanently in both metrics.NewPluginCollector and controller.NewInstanceReconciler. Any sidecar CNPG-i plugin whose Unix socket is created even a few seconds after the postgres container starts is never discovered for the lifetime of the container.
Even though plugin-barman-cloud injects a native sidecar (initContainer with restartPolicy: Always) carrying a startupProbe (/manager healthcheck unix), we observed in production that when a pod sandbox is recreated (e.g., Kata microVM restart) or containers restart concurrently, the postgres container can start before /plugins/barman-cloud.cloudnative-pg.io is listening:
Observed production timeline (2026-10-14):
13:26:22:bootstrap-controllerre-ran (pod sandbox recreated).13:26:23.6:postgrescontainer started and ranRegisterUnixSocketPluginsInPath("/plugins")— socket was not yet present.13:26:26.6:plugin-barman-cloudsidecar opened/plugins/barman-cloud.cloudnative-pg.io(3 s later).13:26:25.9 – 13:31:24: On 1.30.x, every reconciliation loop failed withwhile getting plugin connection: Unknown plugin: barman-cloud.cloudnative-pg.io. PostgreSQL was never started until the 300 sstartupProbekilled and restarted thepostgrescontainer at13:31:24(5 minutes of downtime), after which it immediately found the socket and came up cleanly.
Impact on main (e9eec0d, post-#11858):
In internal/management/controller/instance_controller.go:151-157, the reconciler now intersects cluster.GetInstanceEnabledPluginNames() with the startup availablePluginNames. While that fixes rolling out a newly enabled plugin on pre-existing Pods, if a Pod that does have the sidecar hits this startup race (socket appears 3 s after postgres starts), availablePluginNames stays empty forever — so the instance silently runs without the plugin (missing plugin reconciliation hooks and metrics, or exiting with code 5 on demotion) even though the socket is present in /plugins.
Current workaround:
Wrapping the postgres container command via cnpg.io/podPatch to poll for /plugins/barman-cloud.cloudnative-pg.io (up to 30 s) before exec /controller/manager ....
Expected:
When a Cluster enables a sidecar CNPG-i plugin whose socket is not yet present at startup, the instance manager should either wait/retry scanning PluginSocketDir briefly at startup or lazily re-scan PluginSocketDir when an enabled plugin is missing from pluginRepository (distinguishing between a Pod created without the sidecar vs. a Pod whose sidecar socket has since appeared).
Cluster resource
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: db-example
spec:
instances: 1
plugins:
- name: barman-cloud.cloudnative-pg.io
isWALArchiver: true
parameters:
barmanObjectName: db-example-store
storage:
size: 10Gi
Relevant log output
# 2026-10-14 (1.30.1): postgres container started at 13:26:23.6, barman-cloud socket opened at 13:26:26.6
13:26:25.9 ERROR while getting plugin connection: Unknown plugin: barman-cloud.cloudnative-pg.io
# Repeated until startupProbe (1s x 300) restarted the container at 13:31:24
Code of Conduct
- I agree to follow this project's Code of Conduct
- Lingua principale
- Go
- Stelle
- 9.7k
- Fork
- 826
- Merge medio
- 2g 1h
- PR unite (30g)
- 122
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun 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 cloudnative-pg/cloudnative-pg
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
cloudnative-pg/cloudnative-pg#12059 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Docs]: Document the egress traffic that instance pods need when a NetworkPolicy restricts egressForse di nuovo libera @fjvbn2003 l’ha presa 13 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cloudnative-pg/cloudnative-pg#11750 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: A failed plugin backup sets the deprecated `status.lastFailedBackup`, so `cnpg_collector_last_failed_backup_timestamp` stays newer than the last available backupForse di nuovo libera @fjvbn2003 l’ha presa 13 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
cloudnative-pg/cloudnative-pg#11749 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Managed role stays pending-reconciliation when a membership has several grantor rowsForse già presa @MatheuslFavaretto l’ha presa 45 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
cloudnative-pg/cloudnative-pg#11624 · 2 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: enablePDB=false deletes independently managed PDBs with matching namesForse già presa @WoahitsJoe l’ha presa 61 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
cloudnative-pg/cloudnative-pg#11600 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cloudnative-pg/cloudnative-pg
Issue simili
-
feat(arithmetization): update `arithmetization` to ZkC version `v1.2.38`Forse già presa @DavePearce l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
LFDT-Lineth/lineth-monorepo#4679 ·
I maintainer di solito rispondono entro 1 giorno
-
macOS: MixMusic stalls as the GPU times out drawing frames, and the media keys fail to register at every startForse già presa @fzn0x l’ha presa oggi. Apertabug priority: high
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
funding: failure logs print `<nil>` error and zero channel IDForse già presa @litbot-9000 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
lightningnetwork/lnd#11676 ·
I maintainer di solito rispondono entro 1 giorno
-
effort:s impact:low raised-by:reviewer risk:low
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
medici-finance/assay#8050 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno