Skip to content

test: isolate engine race wave before heavy UTs - #28976

Merged
XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issues-28967-28969-iscp
Sep 16, 2026
Merged

XuPeng-SH merged 4 commits into
matrixorigin:mainfrom
XuPeng-SH:codex/issues-28967-28969-iscp

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Problem

On the constrained Ubuntu race runner, the engine race wave and resource-heavy UTs could overlap. The resulting ISCP scheduling delay could make watermark assertions fail intermittently.

The earlier mitigation reduced the default heavy parallelism from 3 to 2, but that also serialized part of the heavy tail and could increase CI runtime.

Fix

  • Run the two engine race shards as an isolated wave and wait for the helper and report before admitting resource-heavy tests.
  • Restore the default heavy budget to 3.
  • Keep plan and resource-heavy tests overlapped within that budget (default: plan 1 + resource 2), and fall back to sequential waves when the configured budget cannot admit both.
  • Protect the engine helper PID handoff and every metadata/build/list/shard child registration on TERM, so cancellation cannot orphan a child or consume a partial report.
  • Drain already-started engine shards when a later shard report cannot be opened.

No production ISCP code, watermark timeout, retry, or assertion was changed. The scheduler still uses the existing three-slot budget; this follow-up hardens lifecycle ownership without adding a wait, retry, skip, or lower default concurrency.

Validation

  • GOWORK=off go test -mod=readonly ./optools -count=1
  • GOWORK=off go vet -mod=readonly ./optools
  • bash -n optools/run_ut.sh and git diff --check
  • TestHeavyPlanSchedulesEngineBeforeResourceWave: all budget/failure combinations
  • TestEngineChildRegistrationSurvivesCancellation: deterministic spawn-before-PID-publication cancellation
  • TestEngineRaceHelperPublishesCompleteReport: complete two-shard report transfer
  • TestEngineRaceShardReportOpenFailureDrainsEarlierShard: repeated 3 times with a readiness barrier

The change removes the original overlap race without adding sleeps, retries, skips, or a fixed lower concurrency budget. CI can validate the wall-clock result on the constrained runner.

Fixes #28967
Fixes #28969

@XuPeng-SH
XuPeng-SH requested a review from fengttt as a code owner September 16, 2026 05:38
@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 →

@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.

Force deep review 结果(当前 head 2d599cd):

结论:这是有效的 constrained-runner scheduling mitigation,但目前还不能证明是 root-cause fix;也没有证据表明是在故意吞掉失败。把 HEAVY_RACE_PARALLEL 从 3 降到 2 确实移除了 engine/resource 的跨 package overlap,但仍允许两个 heavy package 同时运行,task count 不能证明 16GiB runner 的 memory headroom。请补可比的 16GiB budget=3/2 runs、memory peak/events、CPU pressure、ISCP first-iteration latency 和 wall time。

另有 P2:ut_schedule_test.go:256-287 的 concurrency oracle 不完整。engine 是 mock,heavy-finished 在 heavy process 真正退出前写入;错误的 overlapping scheduler 可能在 heavy 先写 marker 时仍通过。请用 admission/completion barriers 证明 engine 等待 process 完成,并验证两个 engine shards 确实并行;同时补新 default 下的 failure cases,现有 failure rows 使用 budget 3。

源码检查确认 stronger runner 显式设置 HEAVY_RACE_PARALLEL=3 仍保留并行,race/test selection 未被删,heavy/engine/plan failure 仍进入 UT_TEST_STATUS,未发现 cleanup regression。当前建议按 workaround 处理,待资源因果和并发证据补齐后再判断为完整修复。

@matrix-meow matrix-meow added size/M Denotes a PR that changes [100,499] lines and removed size/S Denotes a PR that changes [10,99] lines labels Sep 16, 2026
@XuPeng-SH XuPeng-SH changed the title test: serialize constrained heavy race UT waves test: isolate engine race wave before heavy UTs Sep 16, 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.

Force deep review @ 20358d7

结论:达到 approve-standard;自有 PR 按规则提交 COMMENT。

已确认:

  • engine helper 完成 wait、记录退出状态并消费 report 后,才 admission plan/resource;没有修改生产 ISCP、放宽断言、增加 retry 或 skip;
  • 默认调度为 engine 独占后 plan(1)+resource(2),仍使用三槽预算;engine failure/report failure 保持最终失败状态;
  • TERM 暂存与 trap restore、helper/child PID registration、process group、FD 7 report-open failure drain、join/report ordering 均未发现确定的 orphan、hang 或 partial-report;
  • exact-head Ubuntu UT 日志确认 engine 两 shard 先运行,随后才启动 plan/resource,CI 通过。

边界:HEAVY_RACE_PARALLEL 是阶段性 process/task budget,不是覆盖所有阶段的全局内存上限;一次 CI 也不能证明 flaky 已完全消除,但没有形成当前源码可证明的 P1/P2。

@XuPeng-SH
XuPeng-SH merged commit bb79165 into matrixorigin:main Sep 16, 2026
9 of 11 checks passed

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes [500,999] lines

Projects

None yet

2 participants