fix(proxy): implement graceful shutdown for listener errors to prevent panics#382
Open
rakshaak29 wants to merge 6 commits into
Open
fix(proxy): implement graceful shutdown for listener errors to prevent panics#382rakshaak29 wants to merge 6 commits into
rakshaak29 wants to merge 6 commits into
Conversation
Signed-off-by: rakshaak29 <rakshaak29@gmail.com>
…plateRef claims Signed-off-by: rakshaak29 <rakshaak29@gmail.com>
Signed-off-by: rakshaak29 <rakshaak29@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Integration specs require a configured cluster; running go test ./... without -tags=e2e executed them against the default kubeconfig and failed every BeforeEach. Add //go:build e2e to all test/e2e sources and pass --tags e2e from hack/run-agents-e2e-test.sh so Ginkgo still compiles the suite. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
What type of PR is this?
kind bug
What this PR does / why we need it:
This PR addresses a critical resilience flaw where background listener goroutines in both the
proxyande2bservers useklog.Fatalfupon encountering startup errors (such as port collisions orEADDRINUSE). Becauseklog.Fatalfinvokesos.Exit(255), it completely bypasses the controller's graceful shutdown procedures, leaving active E2B claims, sandboxes, and webhook transactions abruptly killed without draining.Changes introduced:
pkg/proxy/server.go: ModifiedRun(errCh chan<- error)to accept an error channel. WhenListenAndServeorgrpc.Servefails, the error is propagated to the channel instead of panicking.pkg/sandbox-manager/core.go: UpdatedSandboxManager.Run()to establish a cancellablerunCtx. It now listens on the proxy's error channel and seamlessly triggerscancel()to cleanly terminate the infrastructure and memberlist peers if the proxy listeners fail.pkg/servers/e2b/core.go: Replacedklog.Fatalfin the HTTP listener goroutine with a signal directed at the existingsc.stopinterrupt channel (syscall.SIGTERM), safely leaning on the controller's established shutdown mechanics.pkg/proxy/ext_proc_test.goto inject anerrChtoserver.Run(), aligning with the new API. Minor fix applied topkg/servers/web/framework_test.goto handle Go 1.22+ trailing slash redirects (http.StatusTemporaryRedirect) natively to keep CI fully green.Which issue(s) this PR fixes:
Fixes #375
Special notes for your reviewer:
Local tests and linting (
make test,make lint) pass successfully after this refactor. E2E SDK integration checks have also been accounted for.