Repository navigation
Conversation
4d0dc9c to
104e5b3
Compare
|
mo-55 E2E 已完成(验证 head
证据 manifest: |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of exact head f88c875cdf1202d1399760c8da8f6fcd6e09731e against base 99ed717b769e261b842c2f17345bd65865fc1470: REQUEST_CHANGES.
The role-ordering direction is sound, the ordinary same-UUID restart evidence is useful, and the partial-startup/proxy publication repairs are consistent. One lifecycle counterexample remains blocking.
P1 — Dynamic CN can be restarted after the graceful-shutdown PID snapshot and survive the parent
stopAllDynamicCNServicesGracefully snapshots dynamicCNServicePIDs before it calls ChaosTester.Stop(). The HTTP control handler remains active, and startDynamicCNByIndex has no stopping/generation gate.
Concrete interleavings:
- Chaos has killed slot 0, so the shutdown snapshot records PID 0; its already-running restart callback then starts PID 101 before
ChaosTester.Stopreturns. - The snapshot records PID 100; an HTTP
stop/thenstartreplaces it with PID 101 while shutdown is stopping/waiting PID 100.
In both cases PID 101 is absent from the immutable snapshot and receives no SIGTERM. Because dynamic children use Setsid, the new process can survive the parent exit, retain ports/state, and break the next same-data/same-UUID startup. The compare-before-zero logic only prevents clearing a newer PID; it does not terminate that newer PID. This violates the PR's central invariant that all CN ingress/children are closed before TN and LogService.
Please make shutdown an atomic lifecycle transition under the same ownership lock: mark the dynamic manager stopping first, reject HTTP/chaos starts and restarts after that point, quiesce and wait for chaos callbacks/control ingress, and only then snapshot/terminate the final child set. Add deterministic tests for both a restart callback and an HTTP start racing graceful shutdown, asserting no child remains and no new fork occurs after the stopping transition.
I also checked the exact-head CI and focused pkg/common/chaos tests (PASS). The local cmd/mo-service focused binary could not start because this machine has no libmo.dylib; that environment limitation does not affect the source-level counterexample above.
aptend
left a comment
There was a problem hiding this comment.
Deep review of exact head f88c875 against base 99ed717: REQUEST_CHANGES.
I reviewed the design contract, the complete 11-file diff, lifecycle ownership/order, startup cleanup, CN withdrawal, chaos shutdown, tests, and exact-head CI. The dependency-order direction is sound, but the dynamic-CN shutdown still has a blocking producer-versus-snapshot race.
I reproduced it with a deterministic temporary test at the exact head: start with slot PID 100, let graceful shutdown snapshot it, replace the slot with PID 101 while PID 100 is being signaled, and let the old wait complete. stopAllDynamicCNServicesGracefully returned nil while dynamicCNServicePIDs[0] remained 101 (expected 0). The focused CGo test failed exactly on that assertion; the temporary test was then removed. Exact-head CI is green, but it does not exercise this interleaving.
|
Addressed the dynamic-CN shutdown race raised in review. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of exact head 95a81aa2cf2c908280d48ffd6a082409c4f5ed6a against base 99ed717b769e261b842c2f17345bd65865fc1470: REQUEST_CHANGES.
The previous producer-versus-PID-snapshot race is fixed: stopping is now published before chaos is quiesced, the final PID snapshot is taken afterwards, and HTTP/chaos restarts are rejected. Exact-head CI is green. Three lifecycle counterexamples remain:
P1 — A timed-out dynamic CN can survive the standalone parent
Dynamic children are deliberately started in a new session with Setsid: true (dynamic.go#L357-L366). Graceful shutdown sends SIGTERM and waits, but when the one-minute CN phase context expires it returns immediately without SIGKILL or a terminal reap of the remaining children (dynamic.go#L395-L423, lifecycle.go#L192-L210). The main path then returns the shutdown error and exits without invoking the global stopper.
Concrete path: a dynamic CN is stuck in its own shutdown -> the supervisor reaches its one-minute deadline -> the parent exits non-zero -> the independent-session child remains alive, retaining its ports and data directory -> the next same-data/same-UUID startup can collide with the orphan. The current context test explicitly lets the wait remain blocked until the test releases it after the shutdown function has already returned, so it does not prove process-tree termination.
Please add a fail-stop fallback after the graceful deadline: SIGKILL every still-owned child and reap/verify the final child set before the parent leaves. Add a deterministic timeout test whose oracle is that no dynamic child remains alive/owned after return.
P1 — A configured proxy Close failure is reported as a clean phase
pkg/proxy.Server.Close returns the ingress application's Stop error (server.go#L329-L357), but runProxyServerUntilCanceled only logs that error and always returns nil after cancellation (main.go#L541-L555). Consequently the proxy task calls finish(nil), and the supervisor advances to CN teardown even though proxy ingress closure is unknown. That directly violates the design's “an error stops transition” rule and can admit work while its CN dependency is being removed.
Please propagate the Close error into the role's terminal result (without turning it into an unrecorded goroutine panic), and add a test showing that a configured-proxy Close error keeps the CN phase unopened.
P2 — Python UDF is closed before its CN consumer
The phase order is currently proxy -> Python -> CN (lifecycle.go#L188-L197). However Python UDF is a provider used by CN: CN installs the Python client into UdfService (server.go#L238-L269), and query execution calls it with the CN process context (python_udf.go#L108-L116). Closing the Python role kills that process before CN has stopped frontend/query ingress, so an already accepted or direct-CN UDF request loses its provider during “graceful” shutdown.
Please derive the order from the consumer graph: stop/drain CN before Python, and test that the Python provider remains available until the CN phase has completed.
|
Addressed the three current lifecycle findings in exact head
The standalone phase order is now Proxy -> CN -> Python -> TN -> Log. The Python provider remains alive until CN consumers finish, with a barrier/order regression in Local semantic preflight and the complete self-review are PASS. The owning QA required: yes. Please re-review the exact head. |
|
@XuPeng-SH Rechecked the three lifecycle blockers against the new exact head
Validation: semantic preflight PASS; complete self-review PASS; |
|
@aptend Rechecked the dynamic shutdown race and the three current lifecycle blockers against the new exact head
Validation: semantic preflight PASS; complete self-review PASS; |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of exact head 197be8c against merge-base 99ed717: REQUEST_CHANGES.
The previous three blockers are resolved: the dynamic-CN producer/snapshot race is closed, deadline and TERM-failure paths escalate and reap, configured Proxy Close errors stop before CN, and Python remains available until CN drains. Exact-head CI is green. Two lifecycle counterexamples remain.
P1 — Configured Proxy startup failures leave a live but unusable mo-service
At cmd/mo-service/main.go lines 610-620, both a runProxyServerUntilCanceled failure before shutdown and a permanent file-service initialization failure are copied into taskErr and the named task simply returns. finishTask stores that error, but the supervisor only reads it after waitSignalToStop receives an external signal or HAKeeper shutdown. startProxyService already returned success when the task was scheduled, so main can wait forever while the configured Proxy role is gone and the remaining standalone roles stay alive.
Concrete path: launch with -with-proxy; Proxy Start or permanent file-service initialization fails before roleCtx is canceled; proxy-service exits; no shutdown signal is produced; the process remains alive but the SQL ingress it advertises is unavailable. Before this PR these non-cancellation failures panicked and failed fast.
Please preserve a terminal startup/run failure path. Either notify main through a supervisor fatal channel and enter startup-failure cleanup, or distinguish a pre-cancellation error and retain the existing fail-fast behavior while continuing to record Close errors during controlled shutdown. Add a deterministic test proving a configured Proxy startup failure cannot leave main waiting for an unrelated signal.
P1 — Deadline escalation can signal a PID after that child was reaped
At cmd/mo-service/dynamic.go lines 400-459, dynamicWaitProcess reaps the child in a goroutine, but reaped and dynamicCNServicePIDs are updated only later when the result consumer runs. If the wait result and ctx.Done are both ready, select may choose the deadline branch. That branch still sees reaped false and the old PID in the slot, then calls raw syscall.Kill with SIGKILL. At minimum this can turn a clean exit at the deadline into a false ESRCH terminal failure; once Wait has reaped the child and the OS reuses the numeric PID, it can signal an unrelated process.
Please give each child one process identity and serialize Signal/Kill with Wait terminal state, for example by retaining and using the same os.Process handle instead of combining a separate Wait object with raw PID kills, or by an equivalent handshake that makes post-reap signaling impossible. Add a deterministic boundary test where Wait has completed before deadline escalation and assert that no SIGKILL is sent after reap.
Validation reviewed: full 13-file change map and lifecycle ownership/wait-for graph, exact-head Linux UT/SCA/Coverage/standalone and proxy BVT checks all green, pkg/common/chaos race stress PASS. Local CGo wrapper correctly rejected cross-worktree artifact reuse because native inputs differ; no local cmd/mo-service CGo PASS is claimed.
|
Addressed the current-head lifecycle findings in
Validation: Please re-review this exact Ready head. |
|
Follow-up on exact head The prior Linux connector job exposed a portability compile failure in the new dynamic-process launch path: The Ubuntu UT and coverage failures on the preceding head stopped in Please re-review this exact Ready head. |
|
@XuPeng-SH Follow-up for exact head This update addresses the two exact-head local reproductions behind the previous red UT/Coverage checks:
Validation on the exact candidate:
The prior required run |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of dc8a2be. The previous async configured-Proxy startup notification and stale raw-PID signaling findings are addressed. Role ordering and Python-provider lifetime are also improved. Two failure-closure issues remain, both reproduced with review-only tests against this head (see inline comments).
Verification: inspected all changed production files and tests, traced normal/startup/fatal shutdown separately, ran the existing focused supervisor/dynamic-shutdown tests plus two new counterexamples through the controlled macOS CGo wrapper. Existing selected tests did not fail; both counterexamples failed as described. git diff --check passed. No production edits, restart workload, or Linux-specific execution is claimed.
Please fix the distinction between successful reaping and successful CN shutdown, and make child ownership cleanup common to every terminal error path, without cancelling in-process dependencies out of order. Add production-boundary regressions for nonzero/signaled exit and normal-signal/HAKeeper shutdown with Proxy close failure.
aptend
left a comment
There was a problem hiding this comment.
Deep re-review of exact head dc8a2be98bae15a72cf29bdbdaf33ef06a0f1aec against base 99ed717b769e261b842c2f17345bd65865fc1470: REQUEST_CHANGES.
I read the full review/comment/thread history, checked the complete diff, and separately audited the increment since my prior review at f88c875cdf1202d1399760c8da8f6fcd6e09731e. The earlier dynamic-CN producer/snapshot race is closed, as are the later timeout escalation, configured-Proxy error propagation, Python ordering, async Proxy failure notification, and stale raw-PID signaling findings. Two exact-head shutdown invariants remain open (inline).
I reproduced both with review-only tests on Linux at this exact head: (1) a real /bin/sh -c 'exit 23' child was reaped but stopAllDynamicCNServicesGracefully returned nil; (2) the HAKeeper/normal path returned a configured-Proxy close error with cleanupCalls=0. The temporary tests were removed. make thirdparties; normal tests for pkg/common/chaos, pkg/cnservice, and cmd/mo-service; focused race tests for chaos/supervisor/dynamic/proxy paths; and git diff --check all pass. Exact-head GitHub CI is green.
|
Addressed and pushed at exact head
Validation on this exact content:
The required checks for the superseded head were green before this push; fresh checks for this exact head are left to the normal PR workflow and were not rerun manually. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of 89fc25f against base 99ed717: REQUEST_CHANGES for one P2 test-oracle race.
The previous two production blockers are resolved: Wait now distinguishes successful reaping from clean child exit, releasing matching ownership even on nonzero/signal termination; every shutdown error now reaches common once-only dynamic-child cleanup. I reviewed the full production change map, test changes and earlier findings, including phase ordering, Python lifetime, async Proxy failure notification, partial startup, process identity, escalation, and repeated shutdown. I found no additional concrete production blocker in that pass.
P2 — The post-reap test can reject a valid cancellation outcome
In cmd/mo-service/dynamic_shutdown_race_repro_test.go, TestDynamicShutdownDoesNotEscalateAfterWaitReapsChild observes the ownership slot becoming zero, calls cancel(), then requires NoError from shutdown. Slot clearing does not establish that shutdown has consumed the wait result.
Concrete legal schedule:
- The wait goroutine clears the slot under dynamicCNMu, unlocks, and is preempted before sending on the unbuffered results channel (
dynamic.go, startWait). - The test sees the cleared slot and cancels the context.
- The shutdown select takes ctx.Done, records context.Canceled, sees no remaining owned child, and therefore correctly sends no SIGKILL.
- The waiter resumes and sends its successful result; shutdown drains it and returns context.Canceled.
- The test's require.NoError fails although the no-post-reap-SIGKILL invariant holds. The same outcome is permitted when both select cases are ready.
Please allow nil or context.Canceled in this cancellation-boundary test while retaining the exact no-SIGKILL/ownership assertions, or add explicit barriers that establish the particular ordering the oracle requires. Slot visibility alone cannot prove result consumption. This is a flaky assertion, not missing test evidence or a newly identified production shutdown defect.
Validation: current-head CI run 34081345033 has passing UT, SCA, coverage and proxy/multi-CN BVT. I ran a minimal standard-library scheduling model using the same clear-slot/unbuffered-result/select protocol, with barriers selecting the interleaving above: slotCleared=true shutdownError=context canceled SIGKILLCount=0 NoErrorOraclePass=false. This was a scheduling proof, not an execution of the full MatrixOne test; no local native/full-suite PASS is claimed. No repository source was modified. Deployed restart/upgrade acceptance remains as documented in the PR.
aptend
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 89fc25fb61434f56aa8f5154219c439a135b2ca3, including every prior review/thread, the complete PR diff, and the increment since my previous reviewed head dc8a2be98bae15a72cf29bdbdaf33ef06a0f1aec. The two previous production blockers are closed: child exit status is now preserved, and normal signal/HAKeeper shutdown failures share the bounded dynamic-CN cleanup path. One deterministic test-oracle race remains, described inline, so I am requesting changes. Validation on the exact head: affected package tests passed; focused race tests passed 100 runs; the current test passed 10,000 normal and 1,000 race runs; vet and diff checks passed. A barrier-controlled counterexample reproduced the legal failing schedule 100/100 times and was removed afterward.
|
Addressed the shutdown-race follow-up and pushed exact head
Validation at this exact head: controlled CGo focused dynamic tests PASS; |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 505377b0a5d2340389f7d4f0f9395671450a42d2: approve. The prior requested change is closed.
The reaped-child cancellation test now accepts either nil or context.Canceled while retaining the no-SIGKILL assertion. That matches the actual valid schedules: slot ownership can be cleared before the wait-result send is received, and cancellation can win the select in that interval. The old flaky NoError oracle is no longer imposed; unrelated errors are still rejected.
The additional force-stop repair is sound: SIGKILL no longer clears the only child slot before Wait consumes its status. The slot remains owned through reap, restart is excluded under the existing dynamic mutex, and graceful shutdown cannot concurrently claim that child because it sets/checks the same stopping state under the mutex. A successful reap of an intentional SIGKILL is treated as success for chaos stop; graceful shutdown still reports abnormal exit status. ErrProcessDone is tolerated for signaling while Wait remains the ownership oracle. The real-child test checks that a second wait cannot reap it again.
I rechecked the unchanged graceful escalation path: generation/object plus PID identity protects slot clearing and post-cancellation escalation; already-reaped slots are not killed; wait results are collected before returning. Failed reap retains ownership and propagates an error rather than pretending the child disappeared. No new goroutine, hot-query-path work or data-format contract is introduced by this increment. As before, reap completion relies on the OS completing process termination; this is not a claim of a hard deadline against an uninterruptible kernel wait.
Evidence: exact delta from previously reviewed 89fc25f (two files), current child ownership/start/stop/cleanup source, new test oracles, and existing green current-head CI. The broader supervisor/dependency-order review from the previous head remains applicable because that code is unchanged. No new local native execution or benchmark is claimed. No concrete remaining blocker found.
Merge Queue Status
This pull request spent 32 minutes 55 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #28015 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
|
aptend
left a comment
There was a problem hiding this comment.
Deep re-review completed on exact head 505377b.
I read the complete review/comment/thread history, rechecked the full 13-file change, and audited the increment since my previous reviewed head 89fc25f. The prior test-oracle blocker is closed: the shutdown race test now accepts both valid completion outcomes (nil and context.Canceled) while preserving the assertions that no SIGKILL is sent and the child slot is cleared.
The new force-stop/reap path is internally consistent: dynamicCNMu prevents restart or graceful-shutdown overlap; ownership remains in the slot through SIGKILL and Wait; the slot is cleared only for the matching child generation after a confirmed reap; and expected signal-exit status is ignored only on the explicit force-stop path. Treating os.ErrProcessDone from Signal as non-fatal is also sound because Wait remains the reaping/ownership oracle.
Validation on this exact head:
- go test -count=1 ./cmd/mo-service ./pkg/common/chaos ./pkg/cnservice
- focused dynamic shutdown/reap race tests with -race -count=100
- full ./cmd/mo-service with -race -count=1
- git diff --check
No remaining blocking issue found.
What type of PR is this?
Which issue(s) this PR fixes:
issue #27945
What this PR does / why we need it:
Problem
Standalone clean restart must stop every owned dynamic CN child before the parent exits, must not advance the supervisor after a configured Proxy shutdown failure, and must keep the Python UDF provider alive until CN consumers have drained.
Changes
Close()error as the supervisor terminal error, so the CN phase is not entered after Proxy shutdown fails.breakreported by golangci-lint SA4011 in the dynamic-CN shutdown deadline branch.Compatibility and non-goals
The existing graceful shutdown, cancellation, and restart semantics remain unchanged for successful paths. This change only makes terminal failure and provider-ordering contracts explicit; it does not alter SQL behavior or issue metadata.
Validation
mainat99ed717b769e261b842c2f17345bd65865fc1470; source head197be8c27524483c5b1eebbed7aadd9d60ee800d; clean semantic-preflight diff SHA-256825ca3bbfb5d0d44f9d9d8e3af32c2ef26d7ad9cc1821bfc0d4133edbde3221e.go list -mod=readonlyforcmd/mo-service,pkg/cnservice, andpkg/common/chaos: PASS.pkg/common/chaosunit tests, build, and vet: PASS.-race -count=100, plus one full owning-package race run: PASS.git diff --check: PASS.cmd/mo-serviceandpkg/cnservicefocused CGo tests:blocked_externalbefore test compilation because the worktree lackscgo/libmo.dylib; no unbounded native build was started and no local CGo PASS is claimed.34007471347had the independent Linux/arm64 SCA SA4011 failure atcmd/mo-service/dynamic.go:461; this new head contains the one-line fix. Fresh CI checks for197be8c27524483c5b1eebbed7aadd9d60ee800dare pending, so CI is not claimed green.QA decision
QA required: yes
QA should validate the exact head with the standalone production entrypoint: graceful shutdown, dynamic-CN timeout and SIGTERM-failure escalation with no alive owned child, configured Proxy
Close()failure with CN unopened, and the CN-before-Python provider barrier. Verify the same UUID/data restart and HAKeeper view/metadata admission after shutdown. Automated terminal coverage is included above; deployed/manual lifecycle validation remains required.This PR remains Ready for review.