Repository navigation
Conversation
nobbs
marked this pull request as ready for review
October 26, 2026 14:21
nobbs
requested review from
a team,
Steve-Glass,
mumoshu,
nikola-jokic,
rentziass and
toast-gear
as code owners
October 26, 2026 14:21
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The polling and cleanup deadlines change production recovery policy and require maintainer confirmation.
No open issues 🎉
What changed in this PR
This PR bounds listener recovery time after stalled broker requests and prevents intentional metrics shutdown from obscuring the listener error.
Changes:
- Limit each broker poll, including retries and token refresh, to three minutes.
- Give session cleanup an independent ten-second deadline and log listener failures before cleanup.
- Preserve shutdown causes and add regression coverage for polling, cleanup, and metrics shutdown.
| File | Description |
|---|---|
cmd/ghalistener/metrics/shutdown_test.go |
Tests intentional shutdown, cause logging, and unexpected closure. |
cmd/ghalistener/metrics/metrics.go |
Logs cancellation causes and suppresses expected server-closed errors. |
cmd/ghalistener/main.go |
Wires bounded polling, limits cleanup, and logs failures promptly. |
cmd/ghalistener/main_recovery_test.go |
Adds a container-only regression for stalled cleanup authentication. |
cmd/ghalistener/broker_poll_test.go |
Tests polling deadlines, retries, refresh, recovery, and cancellation. |
cmd/ghalistener/broker_client.go |
Adds the three-minute whole-poll deadline wrapper. |
Review effort: Balanced
nobbs
force-pushed
the
fix/arc-0151-listener-recovery
branch
from
October 29, 2026 07:46
3182678 to
c846313
Compare
This branch has not been deployed
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.
Summary
A stalled broker poll can spend roughly ten minutes in SDK retries. When the listener finally returns an error, session cleanup uses a background context and can block again on authentication. The pod stays alive, delaying listener replacement and the terminal error log.
The three-minute polling budget permits one full failed attempt followed by a normal fifty-second poll. Unexpected metrics-server closure still returns an error. The cause of the initiating broker failure remains unconfirmed.
Evidence
actions/scalesetv0.5.0 requests with virtual time reproduce five stalled attempts taking approximately 10m15s–10m22.5s; token refresh can extend the call further. After: stalled calls terminate at three minutes across retries and refresh. Normal fifty-second polls, transient 503 recovery, recovery after one stalled attempt, and parent cancellation pass in ten repeated runs.TestRunReturnsAfterBrokerFailureWhenCleanupAuthenticationStallsdrives the real listener entrypoint against local HTTP APIs and fails because cleanup prevents exit after polling stops. After: the same isolated Linux-container regression passes 3/3, exiting after ten seconds of stalled cleanup and retaining the original polling error. Its polling deadline is shortened to four seconds; the separate SDK tests exercise the real two-minute attempt timers.http.ErrServerClosedand logs onlycontext canceled. After: cancellation before and after binding returns normally and retains the cancellation cause; unexpected closure remains an error.go test -race ./cmd/ghalistener/... -count=1,go vet ./cmd/ghalistener/..., andgolangci-lint run ./cmd/ghalistener/...with v2.15.0. The Linux amd64 listener builds. API-server integration coverage requiringKUBEBUILDER_ASSETSand live GitHub/cluster acceptance were not run.The entrypoint test uses synthetic credentials and local fake GitHub/Actions and Kubernetes APIs. To reproduce it on an Apple Silicon Docker host:
Use
GOARCH=amd64for an amd64 Docker host. Service-account files are created only on the disposable container's tmpfs.Merge Danger
Door: two-way
Reverting restores the previous polling and shutdown behavior; there is no persisted API or CRD change.
Blast Radius: listeners
A prolonged broker failure can cause earlier listener replacement. The three-minute poll and ten-second cleanup limits are explicit recovery-policy choices for maintainer review. No live deployment has been performed.