fix(proxy): retry HAKeeper errors during bootstrap#25778
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
The production change looks sound: transient HAKeeper failures are retried within a real wall-clock bootstrap deadline, request/parent cancellation is propagated, and the task/ticker/error state all have bounded lifecycles. The focused tests, race run, full proxy package, and CI are green.
One blocking regression-coverage gap remains. The lifecycle behavior added in server.go is not tested: TestBootstrapReturnsContextCancellation calls bootstrapWithTimeout with a directly canceled parent context, so it bypasses the new Stopper taskCtx -> context.AfterFunc -> bootstrapCtx chain. If that wiring is removed or broken later, all new tests still pass while Server.Close can fail to terminate an in-flight bootstrap through the intended managed-task path. Please add a deterministic test around the actual Stopper task (or Server.Close): wait until the mock GetClusterState request has started, invoke Stopper.Stop/Close, then prove the request context is canceled, shutdown returns, and the task reaches its terminal state.
Please also make the new tests slow-CI safe while updating them. TestBootstrapReturnsTimeoutAfterPersistentHAKeeperError asserts completion in less than one second, which is a scheduler/performance assertion unrelated to the functional contract and can flake on a loaded runner. Remove that wall-clock assertion and use only a generous timeout as a deadlock guard; likewise, the one-second channel guards in the cancellation test should be generous guards rather than tight scheduling requirements. The 50 ms bootstrap timeout can remain the semantic stimulus—the test should assert DeadlineExceeded plus the retained HAKeeper error, not machine speed.
b529068 to
93e38f4
Compare
Merge Queue Status
This pull request spent 1 hour 6 seconds in the queue, including 59 minutes 47 seconds running CI. Required conditions to merge
|
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #25737
What this PR does / why we need it:
Proxy bootstrap had a five-minute retry window, but a single HAKeeper
GetClusterStateerror panicked from an unmanaged goroutine and bypassed that window.Changes:
GetClusterStateerrors within the existing five-minute bootstrap window.Semantics:
Decision / Non-goals / Risks:
NewServer, and changing process/readiness policy is outside this fix.MOCluster.Closewaiting for an independent firstGetClusterDetailsrefresh is a pre-existing clusterservice lifecycle concern and is not changed here.Validation:
go test ./pkg/proxy -run '^TestBootstrap' -count=20go test ./pkg/proxy -count=1go test -race ./pkg/proxy -run '^TestBootstrap' -count=1go vet ./pkg/proxygit diff --check upstream/main...HEADmo-self-reviewfull diff gate, including Q1-Q3 lifecycle checks