Repository navigation
Description
Summary
Remote dispatch can falsely fail a valid query when receiver registration takes longer than 30 seconds.
The regression was introduced by commit 36016d54a8a5ea4d1bda127e11a402c828538bd7 / #24269. That change replaced the previous 3600-second wait with fixed 30-second watchdogs and introduced the current error:
internal error: dispatch process not registered within 30s, remote CN may have failed
The timeout detects slow registration as if the remote CN had failed. This is timing-sensitive and therefore appears intermittently under slow external scans, JOIN preparation, high concurrency, GC, or storage/network pressure.
This issue tracks the timeout/readiness design regression separately from workload-specific symptom issue #25211.
Regression evidence
A history search for both the error string and timeout constant points to the same first main commit:
36016d54a8a5ea4d1bda127e11a402c828538bd7
fix(pipeline): replace busy-wait polling with channel-based notification (#24269)
Before #24269:
HandleNotifyTimeout = 3600 * time.SecondAfter #24269:
const waitRegistrationTimeout = 30 * time.Second
const waitRemoteRegTimeout = 30 * time.SecondIt also introduced:
"dispatch process not registered within %s, remote CN may have failed"The PR stated that registration normally happens within seconds. That assumption does not hold for all execution topologies: remote/pre scopes can begin notify processing before the coordinator/local dispatch reaches Dispatch.Prepare and publishes its receiver UUID. Slow Hive external-scan/JOIN preparation can expose this ordering window for longer than 30 seconds.
The later fixes also corroborate incomplete registration coverage:
- fix: register remote dispatch receivers early #25238: early registration for decoded remote scopes
- fix: make remote dispatch registration race-safe #25574: early/race-safe registration for coordinator/local dispatch receivers
- fix: register local dispatches below remote scopes #25664: registration below nested remote scopes
- fix: isolate colexec server by CN service #25682: per-CN
colexec.Serverisolation for standalone Multi-CN - fix: wait for remote receivers on empty dispatch #25688: wait for receiver attachment on empty dispatch
These fixes cover specific paths, but the fixed watchdog still conflates receiver readiness with remote CN failure.
Intermittent pass/fail evidence
The same Hive Partition job alternates between success and failure, so a one-shot bisect is not reliable:
| Run | Hive job result |
|---|---|
| 28061543580, job 83097381717 | success |
| 28133872754, job 83335832278 | failed with dispatch registration timeout |
| 28721408964, job 85236481992 | success |
| 28756800333, job 85273758086 | failure |
| 28902823580, job 85780232473 | success |
| 29054645722, job 86253126494 | failed with receiver lifecycle/registration errors |
| 29170188051, job 86594634090 | success |
| 29211194235, job 86704634878 | failed with dispatch registration timeout |
Latest main occurrence
The latest affected path is documented in #25211:
- Run: 29428464735
- Job: 87416236626
- MatrixOne commit:
0d8111aef18ed25aa4eb35113f8bea9e6ab66587
That commit already contains #25682. The same Hive fact/dimension JOIN stopped making progress and hit the client-side 1800-second timeout.
The latest runner log does not expose the inner 30-second dispatch error, so it proves recurrence on the same SQL path but does not by itself prove the latest hang has the identical internal cause. CN logs and a query profile are still required for that run.
Also, #25682 primarily fixes multiple CN services sharing one process in standalone Multi-CN. The TKE reproduction uses separate CN pods/processes, so per-service server isolation does not remove the TKE registration-ordering problem.
Affected SQL
select d.part_name, count(*) as rowcount
from external_hive_partition_2000_large.fact_hive_2000 f
join external_hive_partition_2000_large.dim_part_2000 d
on f.part_id = d.part_id
where d.part_id in (1, 7, 2000)
group by d.part_name
order by d.part_name;Expected behavior
A valid slow query must not be classified as a remote CN failure merely because receiver registration has not happened within a fixed 30-second wall-clock window.
Remote dispatch should either:
- establish an explicit receiver-readiness/registration handshake before remote notify begins; or
- start a bounded failure timeout only after the relevant scope is expected to be registration-ready.
The original/root error should be preserved when registration does fail.
Suggested fix direction
- Define an explicit lifecycle for receiver creation, registration, attachment, cancellation, completion, and retry.
- Publish all coordinator/local receivers before starting any scope goroutine that can notify them.
- Do not use a fixed pre-readiness timeout as proof that a remote CN failed.
- Add receiver UUID, query/statement ID, source/target CN service, scope topology, and registration/attachment timestamps to logs and metrics.
- Add deterministic tests with an injected delay longer than 30 seconds before
Dispatch.Prepare. - Run the affected Hive JOIN repeatedly per commit; classify a commit only after multiple attempts because the failure is flaky.
- On client timeout, cancel the server query and recreate the connection before executing the next statement.
Related issues and PRs
- Hive partition JOIN queries intermittently fail with dispatch timeout (dispatch process not registered within 30s) #25211
- [Bug] TPCC 1000 terminals hits dispatch process registration timeout during STOCK_LEVEL query #24930
- fix(pipeline): replace busy-wait polling with channel-based notification #24269
- fix: register remote dispatch receivers early #25238
- fix: retry remote notify before dispatch registration #25475
- fix: make remote dispatch registration race-safe #25574
- fix: register local dispatches below remote scopes #25664
- fix: isolate colexec server by CN service #25682
- fix: wait for remote receivers on empty dispatch #25688
Activity
Ariznawlll commentedon Jul 16, 2026
Failure steps from run 29428464735
Source run: Big Data Test 1Y (main) / 29428464735
Tested versions:
0d8111aef18ed25aa4eb35113f8bea9e6ab66587053ab522aefefed886bcff64df146e31d312106fMO_REGRESSION_SQL_TIMEOUT=1800Relevant failed job and step
Run Test - 16 Hive Partition2026-07-15 17:32:30 UTCto19:51:14 UTCcases/big_data_test/04_QUERIES/29_external_hive_partition_agg_join.sqlexecute_failed, process exit code1The preceding Hive cases completed:
24_external_hive_parquet_issues.sql26_external_hive_partition_scan.sql27_external_hive_partition_pruning.sql28_external_hive_partition_filepath.sqlInside
29_external_hive_partition_agg_join.sql, the first six statements also completed. The sixth statement was the correlatedEXISTSquery; it completed in98,976.91 ms. The next statement was the first effective failure.First effective failure
Started at
2026-07-16 01:51:12 +08:00and reached the client-side 1800-second timeout at02:21:12 +08:00:Runner error:
Subsequent timeouts
The runner then continued on the same PyMySQL connection/cursor:
02:21:12part_idandcol_uuid02:51:12after 1800s02:51:12UNION ALL03:21:12after 1800s03:21:12GROUP BY part_id ORDER BY rowcount DESC03:51:12after 1800sFinal log:
Only the first fact/dimension JOIN should currently be classified as the primary failure.
func_timeoutreturns control to the runner without proving that the server-side query was cancelled, and the runner reuses the same connection/cursor. The following three timeouts can therefore be cascading effects and should not be counted as four independent MatrixOne failures.Other failed job in the same run
The run also contains an independent failure:
Run Test - 12 Window Function07_WINDOW/11_combo.sqlfor theavg_vol_20d/vol_ratioquerycompare_failed, exit code1That Window Function comparison failure is unrelated to this remote-dispatch/Hive issue and is listed only to account for every failed job in the workflow run.
fix(pipeline): make remote receiver readiness lifecycle-driven (#25820)
XuPeng-SH commentedon Jul 21, 2026
should be fixed
Ariznawlll commentedon Jul 21, 2026
在最新 main 分支完成修复点验证,结论:固定 30 秒 watchdog 导致慢注册被误判失败的问题已在代码层面修复。
测试版本:
e12060afffb8985b749b1fbba590f3d8d626d8337ffd26c7e167ff4b5fc3ce01313c49101116ea9b)测试过程:
NotRegisteredlegacy retry:可以越过旧的固定等待阈值继续重试,但必须受 query context 限制;无关错误不会进入无限 retry。-race重复执行 3 轮。覆盖的核心测试:
TestAttachProcByUuidOrWaitPreservesTerminalOwnerTestCancelConsumedDispatchRegistrationCancelsOwnerProcessTest_GetProcByUuid_CancellationDoesNotPoisonLaterRegistrationTest_GetProcByUuid_WaitsPastFormerAdmissionLimitForRegistrationTestWaitRemoteRegsReadyCancellationAfterPartialRegistrationTestWaitRemoteRegsReadyFailsWhenRegistrationChannelClosesTestWaitRemoteRegsReadyWaitsPastFormerAdmissionLimitTestHandlePrepareDoneNotifyObservesMessageCancellationAfterAttachTestSendNotifyMessageLegacyRetryStopsAtQueryCancellationTestSendNotifyMessageLegacyRetryWaitsPastFormerAdmissionLimitTestSendNotifyMessageSuccessfulAttachUsesQueryContext测试结果:
-race下各执行 3 轮,全部通过。waitRegistrationTimeout = 30s/waitRemoteRegTimeout = 30s作为 receiver readiness 失败依据,等待由 receiver 生命周期和 query/connection cancellation 驱动。验证边界:
本轮完成的是可确定覆盖原 timeout/readiness 逻辑的代码级回归,没有重新触发 issue 中的 Hive 大数据/TKE 端到端 SQL。因此可以确认固定 30 秒误判的代码路径已修复;实际 Hive 长查询链路仍由后续 big-data/nightly 继续观察。
Ariznawlll commentedon Jul 21, 2026
big-data中的hive partition需要再观察一下
Ariznawlll commentedon Jul 21, 2026
CN 日志验证:7/15 和 7/20 两次 run 的对比
最新测试job:https://github.com/matrixorigin/mo-nightly-regression/actions/runs/29764908174
对 7/15 run(本 issue comment 中分析的那次)和 7/20 run 分别查了 CN server Loki 日志,结论如下:
7/15 run (29428464735, commit
0d8111a)CN 日志中两种错误同时存在:
1.
remote receiver not ready within 30s(本 issue 描述的 30s watchdog 错误):2. 全集群 i/o timeout 级联:
6z9sk(10.143.116.192): 从 17:50:21 开始对所有节点 i/o timeoutkv7s2(10.143.116.193): 从 17:50:02 开始对所有节点 i/o timeoutmo.table.stats.task每 30s 报waited err another 30s, total=103, left=103use of closed network connection7/20 run (29764908174, commit
0102f7b)CN 日志中只有 i/o timeout 级联,没有 30s 错误:
messageBoard length: 0, waiting message timeoutremote receiver not ready within 30s原因:commit
0102f7b已包含 #25820 修复(lifecycle-driven 等待取代固定 30s watchdog),所以 30s 误报不再出现。但底层的 CN 资源耗尽问题仍在,查询从"30s 报错退出"变成了"无限 hang 到客户端 1800s 超时"。根因链
本 issue 的 30s watchdog 修复 (#25820) 是正确的——它消除了误报。但 Hive 外部扫描导致的 CN 资源耗尽是更深层的根因,单独追踪在 #25980。
建议
本 issue 可以在 #25820 验证通过后关闭(30s 误报已修),Hive 扫描资源耗尽问题在 #25980 继续跟踪。
fix(pipeline): normalize retained dispatch receiver routes (#26025)
Ariznawlll commentedon Jul 27, 2026
https://github.com/matrixorigin/mo-nightly-regression/actions/runs/30212499592
最新的main修复了
commit:8bcc120025d0988c9033abaa03187e2d7d2d1d90
fix(pipeline): make remote receiver readiness lifecycle-driven (matri…
fix(pipeline): normalize retained dispatch receiver routes (matrixori…
fix(pipeline): make remote receiver readiness lifecycle-driven (matri…
fix(pipeline): normalize retained dispatch receiver routes (matrixori…
fix(pipeline): make remote receiver readiness lifecycle-driven (matri…
fix(pipeline): normalize retained dispatch receiver routes (matrixori…