Repository navigation
fix(cnservice): preserve pipeline connect retry budget - #28922
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? |
6f3c9ca to
5c71ad9
Compare
aptend
left a comment
There was a problem hiding this comment.
Deep review of exact head 5c71ad9cc73b4602c1c37fec2eb41da1a32f1dee: no blocking findings.
Unhappy-path audit:
| Layer | Q1: cleanup ownership | Q2: wait termination | Q3: growth bound |
|---|---|---|---|
| Pipeline client | client owns the published backend | queue and factory waits retain their configured bounds | per-remote backend cap remains unchanged |
| auto-create manager | canceled/late successful creates retain and close their late backend before releasing the slot | caller context, create-state completion, queue deadline, and factory deadline all wake waiters | create queue is bounded and factory concurrency is fixed at four workers |
| remote backend / goetty | each retry disconnects the prior session; terminal/late-result paths close the backend | one monotonic deadline caps each dial and retry sleep; backend cancellation interrupts sleep; net.DialTimeout bounds an in-flight attempt |
retry timers are scoped and legacy dial goroutines remain bounded by the four create slots |
I also checked configuration clamping, default compatibility, publication/generation races, and the exact first-time-create versus reconnect paths. Validation on this head: make thirdparties; focused regressions with -count=1 and -count=10; focused -race; complete go test -count=1 -timeout=180s ./pkg/common/morpc ./pkg/cnservice/cnclient; and git diff --check. All passed. Exact-head required CI, Ubuntu UT, coverage, SCA, Proxy BVT, and pessimistic Compose BVT are green.
|
Queued — the merge queue status continues in this comment ↓. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 medium deep review at exact head 5c71ad9\n\nP2 — The recovery test has only 100 ms of scheduling tolerance.\nIn pkg/common/morpc/backend_test.go:2676-2681, resetConn() allows 1150 ms, while the fake first dial sleeps 50 ms and production performs five 200 ms retry waits. More than 100 ms of accumulated scheduling delay can make the test fail even when retry-budget preservation is correct. Control elapsed time and retry waiting through an injected clock/wait mechanism while preserving assertions for first-attempt timeout, second-attempt success, and total-budget enforcement; increasing the deadline alone keeps the scheduling dependency.\n\nExact-head CI and owning-package race selections were green, but this test remains timing-sensitive.
|
Addressed in 9168431. Validation:
|
XuPeng-SH
left a comment
There was a problem hiding this comment.
GPT-6 medium deep re-review APPROVE at exact head 891a4c3\n\nAll seven changed files reviewed; the earlier timing blocker is resolved by deterministic clock/wait injection, with recovery and total-budget assertions preserved. Correctness, concurrency, lifecycle, liveness, resource bounds, compatibility, and test closures revealed no blocking regressions. Exact-head CI and author validation passed.
Merge Queue Status
This pull request spent 3 minutes 38 seconds in the queue, with no time running CI. Waiting for any of
All conditions
ReasonPull request #28922 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
…28922) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28895 ## What this PR does / why we need it: The TPCC incident exposed a timeout-budget coupling in Pipeline backend creation: the same default 5-second value was passed to each goetty TCP `Connect` call and used as the total MORPC backend connect/retry window. A single `i/o timeout` could therefore consume the entire recovery window. The retry loop existed, but had no meaningful time left for another connection attempt; concurrent Pipeline streams coalesced on that one failed create state and surfaced 20502 together. This change: - separates one TCP attempt timeout from the total backend connect/retry timeout; - keeps generic MORPC behavior backward compatible unless the new option is set; - configures Pipeline attempts to 1 second inside the existing 5-second total budget, capped when a smaller total is configured; - uses one monotonic deadline to cap the final attempt and retry sleep, and lets backend cancellation interrupt retry sleep; - adds a regression test in which the first dial times out and the second succeeds within the same total budget, plus Pipeline configuration bounds tests. The scheduled remote CN remains fixed and the existing bounded failure contract from matrixorigin#27528 is preserved: this does not reroute a dispatched scope or extend the backend recovery budget. Persistent peer/network outages still fail within the configured bound. The lower-level trigger of the incident (target listener, node/network degradation, or connection pressure) still needs TKE metrics to distinguish; this PR fixes the confirmed client-side loss of retry opportunity. ## Validation - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s ./pkg/common/morpc ./pkg/cnservice/cnclient` - focused regression tests with `-count=5` - focused regression tests with `-race` - `go vet ./pkg/common/morpc ./pkg/cnservice/cnclient` - `git diff --check` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…28922) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#28895 ## What this PR does / why we need it: The TPCC incident exposed a timeout-budget coupling in Pipeline backend creation: the same default 5-second value was passed to each goetty TCP `Connect` call and used as the total MORPC backend connect/retry window. A single `i/o timeout` could therefore consume the entire recovery window. The retry loop existed, but had no meaningful time left for another connection attempt; concurrent Pipeline streams coalesced on that one failed create state and surfaced 20502 together. This change: - separates one TCP attempt timeout from the total backend connect/retry timeout; - keeps generic MORPC behavior backward compatible unless the new option is set; - configures Pipeline attempts to 1 second inside the existing 5-second total budget, capped when a smaller total is configured; - uses one monotonic deadline to cap the final attempt and retry sleep, and lets backend cancellation interrupt retry sleep; - adds a regression test in which the first dial times out and the second succeeds within the same total budget, plus Pipeline configuration bounds tests. The scheduled remote CN remains fixed and the existing bounded failure contract from matrixorigin#27528 is preserved: this does not reroute a dispatched scope or extend the backend recovery budget. Persistent peer/network outages still fail within the configured bound. The lower-level trigger of the incident (target listener, node/network degradation, or connection pressure) still needs TKE metrics to distinguish; this PR fixes the confirmed client-side loss of retry opportunity. ## Validation - `.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s ./pkg/common/morpc ./pkg/cnservice/cnclient` - focused regression tests with `-count=5` - focused regression tests with `-race` - `go vet ./pkg/common/morpc ./pkg/cnservice/cnclient` - `git diff --check` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
issue #28895
What this PR does / why we need it:
The TPCC incident exposed a timeout-budget coupling in Pipeline backend creation: the same default 5-second value was passed to each goetty TCP
Connectcall and used as the total MORPC backend connect/retry window. A singlei/o timeoutcould therefore consume the entire recovery window. The retry loop existed, but had no meaningful time left for another connection attempt; concurrent Pipeline streams coalesced on that one failed create state and surfaced 20502 together.This change:
The scheduled remote CN remains fixed and the existing bounded failure contract from #27528 is preserved: this does not reroute a dispatched scope or extend the backend recovery budget. Persistent peer/network outages still fail within the configured bound. The lower-level trigger of the incident (target listener, node/network degradation, or connection pressure) still needs TKE metrics to distinguish; this PR fixes the confirmed client-side loss of retry opportunity.
Validation
.agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s ./pkg/common/morpc ./pkg/cnservice/cnclient-count=5-racego vet ./pkg/common/morpc ./pkg/cnservice/cnclientgit diff --check