Skip to content

fix(render): log docker network removal failures instead of discarding them - #405

Draft
jcogilvie wants to merge 1 commit into
crossplane:mainfrom
jcogilvie:jco/render-network-cleanup-error
Draft

jcogilvie wants to merge 1 commit into
crossplane:mainfrom
jcogilvie:jco/render-network-cleanup-error

Conversation

@jcogilvie

Copy link
Copy Markdown
Collaborator

Description of your changes

dockerRenderEngine.Setup returned a cleanup that did _ = removeRenderNetwork(context.Background(), networkID), so a failed removal (typically a leaked container still attached to the network, see #396/#397) leaked the crossplane-render-* network silently.

This PR:

  • Logs the removal failure through the engine's logger (Info, matching StopFunctionRuntimes), with the network name, ID and error. It is visible with --verbose. Making it visible without --verbose is tracked separately in render: Function cleanup failures are invisible without --verbose #399.
  • Gives removal a bounded timeout (30s) on a detached context, replacing the unbounded context.Background().

The Engine interface and the cleanup's func() type are unchanged because external tools implement and consume them. Returning the error to callers would need an interface change, so I've left that for discussion.

Tests: no unit test added. removeRenderNetwork calls docker.NewClient() directly, so the package has no seam for it, and testing this path would need a real Docker daemon. I didn't want to add a mocking layer just for this fix. Existing tests pass.

Fixes #398

I have:

  • Read and followed Crossplane's contribution process.
  • Run ./nix.sh flake check to ensure this PR is ready for review. (nix isn't installed here, so I ran go build ./..., go test ./cmd/crossplane/render/... and golangci-lint run ./cmd/crossplane/render/... instead; all pass with 0 lint issues)
  • Added or updated unit tests. (no seam for network removal without a real Docker daemon; see above)
  • Linked a PR or a docs tracking issue to document this change.
  • Added backport release-x.y labels to auto-backport this PR.

Need help with this checklist? See the cheat sheet.

🤖 Generated with Claude Code

…g them

The cleanup returned by dockerRenderEngine.Setup discarded the error from
removeRenderNetwork, so a failed removal (typically a leaked container still
attached to the network) leaked the crossplane-render-* network silently.

Log the failure through the engine's logger with the network name and ID, and
bound removal with a timeout instead of an unbounded context.Background().
The cleanup's func() signature and the Engine interface are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

render: docker engine discards the network-removal error, so crossplane-render-* networks leak silently

1 participant