Skip to content

fix(ci): preserve UT cancellation ownership and cleanup failures - #29802

Merged
XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/ut-cancellation-ownership
Oct 10, 2026
Merged

XuPeng-SH merged 6 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/ut-cancellation-ownership

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #29562. This closes cancellation and cleanup ownership gaps; it does not claim the issue's ten-minute performance target.

What this PR does / why we need it:

The coverage failure in PR #29800 left an embedded helper, active mock test and watchdog after the harness timeout. Deterministic white-box checks demonstrated repeated TERM interrupting cleanup and a further gap: helper status 125 initially retained artifacts, but clearing its PID erased that conclusion; a later root TERM then deleted the artifacts and exited 143.

Reuse the existing process-group drain owners and deadlines:

  • Ignore repeated TERM during cleanup; fence plan metadata/build/inventory/shard PID publication and drain its child groups under one common deadline.
  • Retain a monotonic failed-drain fact for each existing owner independently of PID liveness. A shared join publishes helper status 125 before clearing the PID and carries raw/captured status through TERM at that handoff. TERM during an active wait immediately enters bounded cancellation.
  • Check retained ownership at existing report, cleanup, fallback and admission boundaries. Root failure stops already-admitted companions before post-processing and preserves terminal125. Ordinary test failure and healthy cancellation retain their existing behavior.
  • Keep failed child drains terminal inside engine, prebuild, shared prebuilt execution and inventory helpers. Keep TERM ignored through exit 125 so a second TERM cannot erase the failure before the parent joins. Reuse the parent ownership flags; remove redundant helper status assignments. The common prebuilt stop drains and joins all admitted groups before checking existing watchdog failure markers. A published .drain remains terminal125 after a later successful sweep, report-open failure or cancellation. Normal completion rechecks immediately after watchdog join; a late marker stops other admitted groups before releasing ownership. Remove the duplicated cancellation scan and unreachable marker cleanup.
  • Route issues infrastructure failure through the root termination owner so it always stops heartbeat and admitted companions. Remove the obsolete companion shutdown path. Consolidate engine/plan join handling, including the duplicated overlapped/sequential plan joins.
  • On harness failure, reclaim Linux descendants by exact fixture CASE_DIR and rechecked process start identity. Emergency cleanup remains a failed test. Successful commands do not scan procfs; the 15-second harness timeout and three-second WaitDelay are unchanged.

Regression coverage extends existing fixtures for failed join followed by TERM, re-entry/fallback rejection, engine125, overlapping/sequential plan125, light leases, prebuilt execution, raw/captured status handoffs, publication gaps, repeated TERM, forced root termination and stale identity. The real root dispatch also covers status125 with no companion, healthy light and healthy prebuild companions, plus status7 and success. FIFO barriers prove timer/companion readiness; an independent pipe reader requires natural EOF before fixture cleanup. Preserve passing and ordinary-failure controls. Update the relocated join injection anchor and make the drain-count oracle portable to BSD wc.

Real helper-to-parent regressions additionally cover failed drains with held live children, TERM at the terminal handoff, retained binaries/reports, blocked admission/fallback and late root TERM. Preserve ordinary drained report-open failures and successful fallback controls. Consolidate the previous inventory failure test into this shared consumer fixture. The three TERM handoff regressions fail on pre-fix 3ac2e72, while the drained fallback control passes. The new marker-before-cancellation regression also fails when its six-line cancellation check is removed. EXIT assertions keep a saved output descriptor to remain visible when Bash 5 exits inside a redirected function.

Final validation

Rebased onto main a6e19ccf7761; the base delta affects CDC only, with runner dependencies and lint configuration unchanged.

  • Complete ./optools, Go1.27.1: macOS arm64/Bash3.2 normal88.645s and race88.862s; Linux arm64/Bash5 with init reaping normal33.279s and race34.567s, all passed. Linux prerequisites include libc development headers and the existing Python interpreter in PATH; initial environment failures were corrected without source changes.
  • Two new rows reuse the existing real helper-to-parent fixture: marker plus report-open failure, and marker published at completion with two active shards. They require retained artifacts/marker, protected helper and parent TERM125, blocked admission and all groups drained before fixture cleanup. The promoted pre-fix report-open case fails while its ordinary drained control passes.
  • Focused Linux race stress: shared prebuilt fixture100 repetitions passed (24.519s). Prior parent-handoff96 repetitions remain valid: its fixture and causal paths are unchanged.
  • Incremental SCA across the complete five-file PR: formatting, Bash syntax, diff checks, go vet and repository-pinned molint passed. Configured golangci-lint2.14 checks: zero issues. Pinned2.6 cannot read Go1.27 export data; repository configuration unchanged.
  • Actual gpt-6.1-sol/xhigh design and overall review approved the complete delivery. Final review evidence conditions are closed on the identical five-file diff SHA256 760c1fc97e22119d7f68676a3e8b16b6b25455dcc448eccadaae62ea379fcbb1.

The original timeout's exact initial wait is not established. This affects UT orchestration and fixtures only; no database execution code or SQL behavior changes. Cost is constant per join/admission boundary; no new scheduler, polling loop or normal-path procfs scan. Orphan discovery remains Linux-specific. CI on the updated revision is pending; no BVT or CI completion is claimed.

@XuPeng-SH
XuPeng-SH requested a review from fengttt as a code owner October 9, 2026 17:30
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@matrix-meow matrix-meow added the size/L Denotes a PR that changes [500,999] lines label Oct 9, 2026
@mergify mergify Bot added kind/bug Something isn't working kind/test-ci labels Oct 9, 2026
@XuPeng-SH
XuPeng-SH force-pushed the codex/ut-cancellation-ownership branch from d389e03 to d9d03ee Compare October 9, 2026 18:19
@matrix-meow matrix-meow added the size/XL Denotes a PR that changes [1000, 1999] lines label Oct 9, 2026

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit review: 198af9603bb1e0cd053b317595c67ab5ef529dff

Result: no actionable findings. This review covers this commit's prebuilt .drain handling and its two regression rows. The common stop now checks watchdog markers after draining and joining owned groups, and normal completion checks again after joining the watchdog. The tests cover report-open failure and late marker publication while another shard is active; the ordinary drained control remains intact. I also verified the marker-producing watchdog path against the prior runner: the new head passes, while the prior version fails the marker case and passes the ordinary control.

The owning ./optools normal/race suites pass on Linux and macOS, and the focused Linux race case passes 100 repetitions. Required CI checks for the current head are green. This commit does not establish the separate 600-second CI performance target.

XuPeng-SH added a commit that referenced this pull request Oct 10, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [x] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to #29562; follow-up to #29760.

## What this PR does / why we need it:

Rebased onto main `a6e19ccf7761`. Adds optional bounded overlap to the
existing race-UT dispatcher. Serial execution remains the default;
opting into two processes retains complete package/root coverage and
explicit same-process cluster isolation.

### Design and behavior

- Reuse the existing dispatcher for launch, deadlines, completion,
NDJSON reports and bounded process drainage. Preparation failure may
fall back before execution; runtime failure never reruns completed
roots. Failed drainage retains status 125 and artifacts.
- Reuse the cluster admission manager and its shared gate plus bounded
process slots. Cross-process admission and intentional same-process
borrowing are independent permission bits. A second cluster without
`WithConcurrentTestClusters` fails before services start in both serial
and pooled execution. Explicit borrowers retain the original slot/lock
until the last lease releases; no extra manager, state machine or cached
configuration is added.
- Validate both parallel settings against the exact domain `1|2`; two
issues processes require four batches. Arithmetic-overflow inputs fail
before preparation. Make tests separate configuration stdout from Git
diagnostics and use real detached, untagged, shallow Git metadata.
- Parse actual runner report records strictly: required package/action,
expected-package membership, exact action, unique terminal records and
complete expected coverage. Negative oracle cases cover missing,
malformed, duplicate and unknown events. Existing real runner fixtures
continue consuming the same checker.
- Preserve explicit caller deadlines through metadata-fence lock
acquisition and Commit; only unbounded callers receive the existing
30-second fallback. This removes the private deadline that expired after
a 28.335-second gate wait and caused an unknown Commit response. Remove
the restore test's second retry policy; cancellation, catalog errors and
unknown Commit propagate unchanged.
- Both original review comments are addressed: redundant parallel/batch
and lock-nil guards are removed.

### Verification

- Complete owning admission and optools packages pass in ordinary/race
modes; their unchanged semantics remain valid after rebase.
- Fresh complete owning embed ordinary/race passes at the final rebased
head: 401.6 / 488.6 seconds wall, including the new main CDC real-driver
transient-failure regression, actual concurrent clusters and
cleanup/rollback consumers. Real cluster suites run sequentially.
- Focused permission, process-slot retention, actual Start and cleanup
regressions pass in ordinary/race modes. Bounded exact-root race repeats
pass: permission 73, slot lifetime 100, Start 25, admission lifecycle
100, completed rollback 100. N follows the existing 30-second budget and
100-run cap; owning packages are not repeated for stress.
- Nineteen hand-authored report cases pass in normal/race modes,
including both malformed-record counterexamples. Existing actual runner,
issues-batch, failure-report, timeout and cancellation checks remain
intact.
- Final complete-PR incremental gofmt, Go vet, repository-pinned molint,
golangci-lint v2.14.0, shell syntax and diff checks pass for the
six-package affected closure.
- Exact existing CI coverage parser and ignore rules, with the final
complete PR diff and refreshed affected profiles: **35/39 modified
blocks covered (89.74%)**, above the unchanged 75% threshold. Both new
permission branches are covered.
- Existing CN/compile, real two-CN restore, upgrade and issue28079
normal/race evidence is reused where the code and exercised paths remain
unchanged. No new SQL BVT is needed for the test-admission/report
correction.
- Go 1.27.1, GOMAXPROCS=2, -p=2, authoritative CGo wrapper and private
test namespaces; unrelated machine workloads are preserved.
- Solution/design and independent final overall review use actual
`gpt-6.1-sol` with `xhigh` reasoning; review artifacts remain outside
tracked source.

### Performance and scope

No new real cluster fixture, service setup, retry, goroutine or
persistent state is introduced by the permission/oracle correction. Pure
report cases and synthetic startup callbacks cover its boundaries.
Serial defaults remain unchanged. Historical subset timings motivate the
optional pool but do not establish successful matched full-job
wall-time, CPU or peak-memory savings; those measurements are required
before default adoption.

Separate #29802 owns the root cancellation follow-up. This PR preserves
existing cancellation and failed-drain contracts. Remote CI for the
newly published revision must be evaluated separately from local and
historical evidence.

This branch was previously deployed

1 inactive deployment
ci — 8dedb6bb Deployed Oct 10, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working kind/enhancement kind/test-ci size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants