Repository navigation
Conversation
jcogilvie
force-pushed
the
jco/render-interrupt-cleanup
branch
3 times, most recently
from
October 2, 2026 20:23
68ce410 to
6c34ce5
Compare
jcogilvie
force-pushed
the
jco/render-interrupt-cleanup
branch
3 times, most recently
from
October 13, 2026 17:13
2367976 to
818e267
Compare
Interrupting `crossplane render` leaked every Function container, the render engine container and the temporary network. All of that cleanup is defer-based, but nothing turned SIGINT/SIGTERM into context cancellation, and the spinner's signal handler called os.Exit(130), which skips defers. Derive a signal-aware context in main with signal.NotifyContext and bind it into kong; render xr and render op now base their timeout context on it. The spinner no longer handles signals; the SpinnerPrinter wrappers stop it when the wrapped func returns. An interrupted run exits 130. A second signal exits 130 immediately without waiting for cleanup. A spinner may still be running then, and being killed by the default handler left the cursor hidden and bracketed paste enabled, so main first restores both when stderr is a terminal. Fixes crossplane#400 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
RunContainer blocked in stdcopy.StdCopy, which doesn't observe ctx, so an interrupted render waited until the render container exited by itself (~115s with a hung Function) before cleanup could run. Close the attach connection when ctx is done, and report ctx.Err() rather than the resulting read error. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Signed-off-by: Jonathan Ogilvie <jonathan.ogilvie@sumologic.com>
jcogilvie
force-pushed
the
jco/render-interrupt-cleanup
branch
from
October 13, 2026 18:25
818e267 to
e83f8cf
Compare
jcogilvie
marked this pull request as ready for review
October 13, 2026 18:33
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 32 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of your changes
Ctrl+C/SIGTERM mid-render leaked the Function containers, the render container and the network: nothing turned signals into context cancellation, and the spinner's handler called
os.Exit, skipping defers.mainbinds asignal.NotifyContextcontext into kong;render xr/opuse it, so an interrupt cancels work and deferred cleanup runs. Exit code is 130.SpinnerPrinter's wrappers already stop it when the wrapped func returns.docker.RunContainercloses the attach stream on ctx cancellation. Without this, cleanup waited for the render container to exit: ~115s with a hung Function, now ~0.3s.Verified manually with a hanging Function: exit 130, no containers or network left behind. No automated test for the signal wiring (it needs a subprocess harness).
Note: other commands don't use the bound context yet, so a first Ctrl+C lets them finish before exiting 130 (previously immediate). Wiring them up can be a follow-up.
Fixes #400
I have:
./nix.sh flake checkto ensure this PR is ready for review.Added or updated unit tests.I only updated existing tests for the signature change (see above).Linked a PR or a docs tracking issue to document this change.Addedbackport release-x.ylabels to auto-backport this PR.Need help with this checklist? See the cheat sheet.
🤖 Generated with Claude Code