Skip to content

[Bug] dev:distributed join aborts when remote dispatch targets another local pipeline tree #28313

Description

@Ariznawlll

Description

A valid distributed recursive-CTE join was aborted by the MatrixOne remote execution pipeline. The client received an internal 20101 context canceled error although the configured statement timeout was 3600 seconds and the statement had run for about 0.38 seconds.

The earliest server-side evidence for the same trace reports that a pipeline could not execute remotely because its dispatch operator targeted another local pipeline tree. This is followed by remote receiver closure and an aborted shuffle pool.

Environment

This report is a 1/1 reproduction on the current cn-dev deployment. It does not claim reproduction on official main; that verification is still required.

Steps to reproduce

  1. Load the Jinpan jinpan_001 dataset into a multi-CN MatrixOne deployment.
  2. Execute the @q0261_payment_details_tree statement from j_batch_014.sql, with the concurrent NESR writer enabled.
  3. In the observed run, the statement started at 13:26:16.242 UTC and failed at 13:26:16.625 UTC.

Actual behavior

The client received:

(20101, 'internal error: convert go error to mo error context canceled')

The same trace ID, 61cf8d08-9613-d1ec-213e-2f27969d0b3b, was present on participating CNs cn-rm8h5 and cn-5w5sf.

The first relevant server-side messages include:

the pipeline ... cannot execute remotely because its dispatch operator targets another local pipeline tree
shuffle pool was aborted before prepare completed
invalid state remote dispatch receiver ... is already closed
query interrupted

The failure then propagated to the client as context canceled.

Expected behavior

The valid statement should complete successfully, or return a specific, actionable execution error. A remote dispatch/shuffle topology inconsistency must not surface as the generic internal 20101 context canceled error.

Excluded causes

  • Not a statement timeout: the run configured a 3600-second timeout and this statement failed in approximately 0.38 seconds.
  • Not an OOM or process crash: no OOMKilled, exit 137, panic, or fatal error was found in the event window.
  • Not CN lifecycle disruption: the two participating CNs had zero restart increments in the surrounding 10-minute window; no Draining, Pod deletion, or session migration event was recorded. The coordinator session logged migrate-goRoutineId=0.
  • Not a runner disconnect: the runner reconnected and continued with later SQL files after this file was marked failed.

Evidence

  • Workflow/job links above.
  • Trace ID: 61cf8d08-9613-d1ec-213e-2f27969d0b3b.
  • Server timestamps: 2026-09-06 13:26:16.299–13:26:16.420 UTC.

Related

This is related in symptom to #27776 (remote work interruption), but the observed window contains no CN Draining/reclaim event, so it should be investigated independently.

Activity

  1. added
    kind/bug
    on Sep 7, 2026
  2. changed the title [-][Bug]: distributed join aborts when remote dispatch targets another local pipeline tree[/-] [+][Bug][cn-dev]: distributed join aborts when remote dispatch targets another local pipeline tree[/+] on Sep 7, 2026
  3. changed the title [-][Bug][cn-dev]: distributed join aborts when remote dispatch targets another local pipeline tree[/-] [+][Bug] dev:distributed join aborts when remote dispatch targets another local pipeline tree[/+] on Sep 7, 2026
  4. added 2 commits that reference this issue on Sep 7, 2026
    4503c3b
    fdc1e0c
  5. XuPeng-SH commented on Sep 7, 2026

    @XuPeng-SH
    Contributor

    Root cause is now reproduced and a systematic fix is available in #28358.

    The causal failure is a client-to-server MORPC stream sequence gap, not the placement-probing INFO message highlighted in the original report. Before the fix, Stream.Send consumed a sequence at enqueue time. If that queued request was later skipped by the backend write loop because its context was canceled, its deadline elapsed, or a filter rejected it, the next live control frame arrived with a gap. The deterministic diagnostic capture was last=1, current=3; the server correctly rejected that stream as protocol-corrupt and closed the session, which surfaced as rpc stream closed / generic cancellation at SQL level.

    The cannot execute remotely because its dispatch operator targets another local pipeline tree message is reachable during normal placement probing and is not proof of this failure by itself.

    #28358 moves request sequence assignment to the single transport write loop after all skip checks, seals assignment on stream close, and uses an independent sequence lock so queue backpressure cannot deadlock against the lifecycle lock held during send admission. It is the client-request analogue of the server-response fix in #25811 and applies to pipeline chunks, batch ACKs, StopSending, FIN, and other stream frames without query-specific handling.

    Validation on latest main (fdc1e0ca8f): focused cancellation/filter/close/backpressure tests passed under race 100 times; the full MORPC race package, compile package, vet, and build passed; the existing real two-CN TestIssue28313EmptyRemoteDispatch passed 10 final repetitions (and 50 repetitions during fix validation). The pre-fix stress reproduced the sequence gap and rpc stream closed locally.

  6. assigned and unassigned on Sep 8, 2026
  7. XuPeng-SH commented on Sep 9, 2026

    @XuPeng-SH
    Contributor

    The #28447 UT Coverage failure is now correlated with this existing issue and the already-merged #28358 fix.

    Current main contains merge commit #28358 and the exact regression test passed locally once on the current head (12.62s). The fix covers the transport sequence gap/lifecycle teardown path; this comment records the recurrence without opening a duplicate issue.

  8. iamlinjunhong commented on Sep 9, 2026

    @iamlinjunhong
    Contributor

    CI evidence for PR #28467, exact head ab6165a9411fa0af90f2c118cda2a013475e1a63 (branch m-28451):

    Stable BVT signature from the complete failed job log and execution artifact:

    test/distributed/cases/ddl/comprimary_key.sql, row 34
    internal error: shuffle target receiver <uuid>(ShuffleIdx=3) was removed, data loss may occur
    expected: Duplicate entry ... for key ...
    actual:   internal error: shuffle target receiver ... was removed, data loss may occur
    total:73, success:72, failed:1
    execution success rate is 99%, and less than config value 100%,this test fail.
    

    The Coverage job did not report an independent product failure. Its prerequisite gate failed with:

    coverage merge blocked: a required producer did not publish a complete coverage profile; no coverage verdict was calculated
    

    Attribution evidence:

    1. This is the same normalized shuffle target receiver ... was removed, data loss may occur failure class tracked by this open issue. The existing maintainer analysis identifies the MORPC client-to-server stream sequence/lifecycle mechanism and links the systematic fix in fix(morpc): avoid client stream sequence gaps #28358.
    2. An independent Linux/amd64 CI occurrence with the same signature is recorded in the unrelated PR fix(function): format IPv4-compatible IPv6 addresses #28447 job: https://github.com/matrixorigin/matrixone/actions/runs/34278256047/job/102236643446 (attempt 1), in TestIssue28313EmptyRemoteDispatch.
    3. The current official up/main is 91d7297f46a53797db28a5a6c1c71e45f84fa503 and contains 040356c3ab (fix(morpc): avoid client stream sequence gaps (#28358)). PR fix(mpool): avoid coverage crash in realloc failure test #28467 changes only pkg/common/mpool/realloc_failure_linux_test.go; its dependency closure does not touch MORPC, shuffle/remote-dispatch code, comprimary_key.sql, or the CI harness.
    4. The PR's own changed closure passed on this exact head: focused Linux normal and matrixone_test coverage runs, the owning pkg/common/mpool package test, focused race test, and vet. The existing CI UT/coverage producer, shared build, SCA, and Ubuntu/x86 UT checks also passed in run 34306143038.

    Reproduction: run the multi-CN compose pessimistic BVT suite at the exact head above, then inspect test/distributed/cases/ddl/comprimary_key.sql row 34 and the execution report; the single failed assertion produces the signature above and reduces the required success rate from 100% to 99%.

    This occurrence is being added to the existing open issue rather than creating a duplicate. Per the approved CI intake standard, after this evidence is recorded only the failed jobs of run 34306143038 will be rerun once.

  9. 22 remaining items

  10. XuPeng-SH commented on Sep 22, 2026

    @XuPeng-SH
    Contributor

    Current status on main 3727c5c: the real two-CN TestIssue28313EmptyRemoteDispatch did not reproduce in one focused run followed by a bounded 3-run repetition. Current main contains the three identified fixes: #28358 (MORPC request sequence assignment), #28539 (remote receiver terminal/error ownership), and #28964 (shuffle stopper admission ownership). This is evidence that the exact regression is currently passing, not proof that every historical intermittent cross-CN recurrence is resolved. I am keeping the issue open. A further production patch needs a post-fix reproduction or lifecycle trace that identifies a still-broken invariant, such as unique receiver-generation terminal ownership, preservation of the root error during cleanup, success cleanup not becoming peer cancellation, or failed admission not participating in completion accounting.

  11. XuPeng-SH commented on Sep 22, 2026

    @XuPeng-SH
    Contributor

    Added deterministic post-attachment white-box coverage in #29224. The test drives the real PrepareDoneNotify -> Dispatch.Call attachment -> local cancellation -> Dispatch.Reset terminal -> registration cleanup path. It proves that empty input remains a remote success and an injected duplicate-key root error is not replaced by local cancellation after attachment. A temporary mutation restoring the bad dependency on dispatchProc.Ctx made both cases fail immediately; the clean candidate passes normal/race repetitions and the real two-CN regression. This is additional lifecycle proof, not a claim that the test executes the dedup join operator itself.

  12. added theissue type on Sep 23, 2026
  13. added this to the MO-202609 milestone on Sep 23, 2026
  14. Ariznawlll commented on Sep 27, 2026

    @Ariznawlll
    CollaboratorAuthor

    测试版本

    • MatrixOne main commit: 5be6cd90b501da225be591ffffe6000bf01f515e
    • 测试方式:仓库内真实双 CN embedded cluster 集成测试

    原问题验证

    执行 TestIssue28313EmptyRemoteDispatch,覆盖远端 dispatch 目标为空时的分布式 join/pipeline 调度路径。该测试在最新 main 上连续执行 3 次,均未再出现 remote dispatch 中止或查询异常。

    Happy Path 覆盖

    • 双 CN 下 remote dispatch 正常建立和结束。
    • 空输入场景能够正常完成,不会错误中止 pipeline。
    • 正常结果能够返回调用端。

    Unhappy Path 覆盖

    • 覆盖远端分支为空时的结束信号处理。
    • 覆盖 terminal/root error 的保留与传播。
    • 覆盖清理阶段的 ownership 和资源释放路径。

    白盒验证

    • 当前 main 已包含相关修复提交:040356c3aba7c38e54778af701eaf0cb6f1745d2、fb214b2d3c5624eeeb161d69123eea15d3110854、26fa8c369915cdfdeb4f4af7cf253869d2340b86、11914ae308d2ff9bcbf9fe0adba475a3276cbf32。
    • 精确回归测试直接覆盖本 issue 的双 CN transport/shuffle 生命周期,不仅是单机 SQL 结果校验。

    回归测试

    TestIssue28313EmptyRemoteDispatch -count=3:3/3 通过。

    测试证据

    • Go package 最终结果:ok
    • 三轮执行均无 panic、无 remote dispatch abort、无资源清理错误。
    • 该场景已经由 MatrixOne 仓库内精确的双 CN 集成测试覆盖,因此不再重复加入 SQL 型 MOTR。

    测试结论

    测试通过。

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

Metadata

Metadata

Assignees

Labels

kind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions