render: StartFunctionRuntimes leaks already-started Function containers when a later Function fails to start
Les mainteneurs répondent en général sous 5 jours
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 76/100
Piste de recherche
Start in cmd/crossplane/render/render.go at StartFunctionRuntimes, then inspect the error handling in xr/cmd.go and op/cmd.go. Reproduce with the supplied xr.yaml, composition.yaml, and functions.yaml, and verify that a later startup failure stops earlier runtimes and removes the attached network instead of leaving containers running.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
What happened?
When one Function fails to start, every Function started before it is left running and nothing ever stops
it.
StartFunctionRuntimes
starts Functions in order. If Function N fails (for example its image can't be pulled), it returns
nil, err. Functions 1..N-1 are already running, but their RuntimeContexts are dropped with the partial
FunctionAddresses, so no caller can stop them. In xr/cmd.go and op/cmd.go the
defer render.StopFunctionRuntimes(...) comes after the error check, so it is never registered.
Expected: if StartFunctionRuntimes returns an error, any runtime it already started has been stopped
according to its cleanup policy — or the partial result is returned so the caller can stop it.
This affects library consumers as well as the render commands: any caller of StartFunctionRuntimes has
the same gap.
How can we reproduce it?
xr.yaml:
apiVersion: example.org/v1
kind: XThing
metadata:
name: test-xr
spec:
coolField: hello
composition.yaml — any pipeline referencing the three Functions below, e.g.:
apiVersion: apiextensions.crossplane.io/v1
kind: Composition
metadata:
name: xthings.example.org
spec:
compositeTypeRef: {apiVersion: example.org/v1, kind: XThing}
mode: Pipeline
pipeline:
- step: templating
functionRef: {name: function-go-templating}
input:
apiVersion: gotemplating.fn.crossplane.io/v1beta1
kind: GoTemplate
source: Inline
inline:
template: |
apiVersion: nop.crossplane.io/v1alpha1
kind: NopResource
metadata:
annotations: {gotemplating.fn.crossplane.io/composition-resource-name: nop}
spec: {forProvider: {}}
- step: dummy
functionRef: {name: function-dummy}
input: {apiVersion: dummy.fn.crossplane.io/v1beta1, kind: Response, response: {}}
- step: auto-ready
functionRef: {name: function-auto-ready}
functions.yaml — the last Function's tag has no manifest, so its pull fails:
apiVersion: pkg.crossplane.io/v1
kind: Function
metadata: {name: function-go-templating}
spec: {package: xpkg.crossplane.io/crossplane-contrib/function-go-templating:v0.11.0}
---
apiVersion: pkg.crossplane.io/v1
kind: Function
metadata: {name: function-dummy}
spec: {package: xpkg.crossplane.io/crossplane-contrib/function-dummy:v0.4.1}
---
apiVersion: pkg.crossplane.io/v1
kind: Function
metadata: {name: function-auto-ready}
spec: {package: xpkg.crossplane.io/crossplane-contrib/function-auto-ready:v0.1.2}
$ crossplane render xr.yaml composition.yaml functions.yaml
crossplane: error: cannot start function runtimes: cannot start Function "function-auto-ready": cannot pull Docker image "xpkg.crossplane.io/crossplane-contrib/function-auto-ready:v0.1.2": Error response from daemon: manifest unknown
$ docker ps --format '{{.Names}} {{.Image}} {{.Status}}' | grep function-
suspicious_newton xpkg.crossplane.io/crossplane-contrib/function-dummy:v0.4.1 Up 9 seconds
distracted_mestorf xpkg.crossplane.io/crossplane-contrib/function-go-templating:v0.11.0 Up 13 seconds
Both containers use the default cleanup policy (Remove) and stay running indefinitely. The run's
crossplane-render-* network is also left behind, because its removal fails while these containers are
attached and the error is discarded (#398).
Possible fix: on error, stop the runtimes started so far before returning (e.g. build the
FunctionAddresses as you go and call Stop on it in the error path), or return the partial
*FunctionAddresses alongside the error and document that callers must stop it.
What environment did it happen in?
- Crossplane CLI version: built from
main@29316fea54f2ede9d2c039d9c54f0c29cbad4b65 - Platform (e.g., linux/amd64): darwin/arm64, Docker Engine 29.5.3 (Rancher Desktop)
- Crossplane version (if applicable): render engine image
xpkg.crossplane.io/crossplane/crossplane:stable
- Langage dominant
- Go
- Étoiles
- 22
- Forks
- 38
- Merge moyen
- 5 j 20 h
- PR mergées (30 j)
- 34
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de crossplane/cli
-
[project/schemas]: enum integers Valid() function is missing valuesPeut-être pris @NopeCharon l’a pris il y a 5 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
crossplane/cli#445 ·
Les mainteneurs répondent en général sous 5 jours
-
- In Podman 6.x, the {{.Labels}} template field comes out as a flat string (k=v,k=v) instead of a map, so index .Labels "<key>" can't work.Peut-être pris @prath47 l’a pris il y a 4 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
crossplane/cli#432 ·
Les mainteneurs répondent en général sous 5 jours
-
`credsStore` in docker config causes unit test failuresPeut-être pris @sujeito-operator l’a pris il y a 75 jours. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
crossplane/cli#282 ·
Les mainteneurs répondent en général sous 5 jours
-
[project/schemas]: go types contains conflicting code if two xrd's in same api-group has integer enum fieldPeut-être pris @NopeCharon l’a pris il y a 5 jours. Ouvertebug
Difficulté 3/5 1-2 jours Accessibilité débutants 72/100
crossplane/cli#444 · 1 commentaire ·
Les mainteneurs répondent en général sous 5 jours
-
enhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
crossplane/cli#437 ·
Les mainteneurs répondent en général sous 5 jours
Toutes les issues de crossplane/cli
Issues similaires
-
date_time, url_encode, html_escape, to_unix_time, contains_all and contains_any panic when called without argumentsPeut-être pris @antcybersec l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
projectdiscovery/dsl#372 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
JuliusBrussee/caveman#1449 ·
Les mainteneurs répondent en général sous 1 jour
-
clawsweeper:fix-shape-clear clawsweeper:needs-maintainer-review clawsweeper:needs-product-decision clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster P2
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
openclaw/gogcli#1291 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
apache/arrow-swift#209 ·
Les mainteneurs répondent en général sous 1 jour
-
bug(instrumentation/kafka-go): producer hook writes trace headers into the caller's messagesPeut-être pris @Aryanbhargava18 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
open-telemetry/opentelemetry-go-compile-instrumentation#1669 ·
Les mainteneurs répondent en général sous 2 jours