Skip to content

[Bug] Stability (2734005 / 66dad1483): TPCH q15 hangs forever in RemoteRun receiveMessage + PipelineSignalReceiver; found leak txn unique=1 on live session #26202

Closed

Description

@Ariznawlll

Environment

Field Value
Cluster mo-stb-4-2-dev-2734005-202607231128
Namespace mo-stb-4-2-dev-2734005-202607231128
Image matrixone:commit-66dad1483 (rolled onto this soak ~2026-07-24 14:16 CST)
Endpoint 10.222.6.255:6001
Artifact root /data1/stability-test/29976993561_2734005
Workloads TPCC, sysbench-1, TPCH, qvec, fulltext, issue-24446, issue-10313
Hang window TPCH q15 started 2026-07-26 15:05:28 CST; still COM_QUERY at analysis 2026-07-27 ~11:25 CST (~20h+)

Scope: On a healthy soak (no CN roll at hang time), TPCH q15 never returns. Session stays alive in SHOW PROCESSLIST. Leak-check periodically emits found leak txn for the same txn-id → quality gate FAIL (unique=1). Goroutine dump shows the statement stuck in CN↔CN RemoteRun receive and local PipelineSignalReceiver, not LockService bind.

Out of scope / not this issue:

Related: #26125 (roll-time hangs; aptend: nested shuffle / remote dispatch paths), #25816 (PipelineSignalReceiver), #26025 / #26055 / #26097 (candidate fixes — need confirm whether 66dad1483 includes them; hang still reproduces on this image).

Summary

Signal Value Interpretation
Hung SQL TPCH q15 (CTE q15_revenue0 + join + nested max) Not a slow query — 20h+ with no progress
txn-id 18dd0759dd8a4d5618c52552667de939 Same id in processlist + leak logs
session_id 019f9d3e-36bc-7bdb-a855-3a18c47d98d9
statement_id 019f9d3e-373e-726b-b776-ffa6052d3268
conn_id / CN 2109660 on CN uuid 32656637-3565-3161-6238-393530343535 (tp-cn-glpzt)
goRoutineId (leak options) 24984370 Matches pprof stack below
Leak unique 1 (hits ≈117 over ~24h; do not count log lines) Gate FAIL
wait-active 0; commit ~180/s Cluster otherwise healthy
Parent wait Compile.runOnce chan receive, 1221 minutes Waiting for child scopes
Child A messageSenderOnClient.receiveMessage select, 1219 minutes Remote CN batch never arrives / never EOFs
Child B PipelineSignalReceiver.GetNextBatch → Merge → MergeGroup → HashJoin 1219 minutes Local merge starved

MatrixOne defect: Distributed pipeline for this q15 plan can deadlock / hang without error or cancel: RemoteRun blocks forever in receiveMessage, local consumers block in PipelineSignalReceiver, frontend never leaves Compile.Run. Leak-check then mis-labels the still-live aged statement as found leak txn.

Timeline (CST)

Time Event Evidence
07-24 ~14:16 Full-stack image roll to 66dad1483; CN glpzt created pod creationTimestamp
07-24 15:00→ Lock bind / wait-too-long / 20702 quiet Loki + client error file
07-26 15:05:27 q14 OK (cost 67245 ms); start q15 tpch/.../run.log
07-26 15:05:28 query_start / txn create-at processlist + leak create-at UTC 07:05:28
07-26 ~17:58+ First found leak txn lines for this txn-id Loki / CN logs
→ 07-27 11:25+ Still COM_QUERY q15; TPCH run.log frozen; pprof stacks ~1221 min processlist + :6060/debug/pprof/goroutine?debug=2

Evidence

A. processlist (still present)

account=tpch_test  conn_id=2109660
session_id=019f9d3e-36bc-7bdb-a855-3a18c47d98d9
txn_id=18dd0759dd8a4d5618c52552667de939
statement_id=019f9d3e-373e-726b-b776-ffa6052d3268
query_start=2026-07-26 07:05:28.126918 +0000
command=COM_QUERY
info=with q15_revenue0 as ( select l_suppkey ... ) select ... from supplier, q15_revenue0 where ...

Client: timeout 86400s mysql ... + bash ./run.sh still running under artifact (PID from Jul26).

B. leak log (repeats ~every 10min)

ERROR cn-service found leak txn
  txn-id=18dd0759dd8a4d5618c52552667de939
  create-at=2026/07/26 07:05:28.126941 +0000
  SessionID=019f9d3e-36bc-7bdb-a855-3a18c47d98d9
  ConnectionID=2109660 UserName=admin account=tpch_test
  goRoutineId=24984370
  profile=ETL:/profile/CN_32656637-..._leakcheck_routine_....gz

C. Goroutine stacks (CN glpzt, curl :6060/debug/pprof/goroutine?debug=2)

Same Compile pointer 0x10151f3bc588 on parent + remote child.

Parent (session / leak goRoutineId):

goroutine 24984370 [chan receive, 1221 minutes]:
  compile.(*Compile).runOnce                    compile.go:587
  compile.(*Compile).Run                        compile2.go:261
  frontend.executeResultRowStmt                 result_row_stmt.go:102
  frontend.executeStmt / doComQuery             mysql_cmd_executor.go
  frontend.(*Routine).handleRequest

Remote receive (never completes):

goroutine 24980847 [select, 1219 minutes]:
  compile.(*messageSenderOnClient).receiveMessage   remoterunClient.go:567
  compile.(*messageSenderOnClient).receiveBatch     remoterunClient.go:586
  compile.receiveMessageFromCnServerIfConnector     remoterunClient.go:257
  compile.(*Scope).remoteRun / RemoteRun            remoterunClient.go:109 / scope.go:457
  compile.(*Scope).MergeRun.func1                   scope.go:321
  ants goWorker

Local merge / join starved:

goroutine 24983552 [select, 1219 minutes]:
  process.(*PipelineSignalReceiver).listenToSingleEntry / GetNextBatch  process_spoolr.go
  colexec/merge.(*Merge).Call
  colexec/group.(*MergeGroup).Call
  colexec/hashjoin.(*HashJoin).Call
  colexec/loopjoin.(*LoopJoin).Call
  … filter → projection → order → mergeorder …

Expected vs actual

Expected Actual
q15 Finish in minutes (historical TPCH on same suite) or return error Hang 20h+
Pipeline / RemoteRun Bounded wait + cancel/error on peer stall Infinite receiveMessage / GetNextBatch
Leak-check Only true disconnect orphans, or once Periodic ERROR on live hung statement → gate FAIL

Suspected code paths

Area Path
Remote pipeline client pkg/sql/compile/remoterunClient.go (receiveMessage / remoteRun)
Pipeline spool pkg/vm/process/process_spoolr.go (PipelineSignalReceiver)
Compile wait pkg/sql/compile/compile.go (runOnce)
Leak-check CN leakcheck routine — should distinguish live COM_QUERY vs disconnect orphan

Likely same family as #25816 / fixes discussed under #26125 (#26025, #26055, #26097). Please confirm whether 66dad1483 contains those commits; if yes, this is a residual / different plan shape (q15 CTE + nested max + hash/loop join) still hanging.

Suggested fixes

  1. MO: Ensure RemoteRun / PipelineSignalReceiver always unblocks on peer CN failure, cancel, or idle timeout; propagate error to Compile.Run.
  2. MO: Statement/query cancel deadline for distributed pipeline (do not rely on client timeout 86400s alone).
  3. MO / gate: Leak-check: do not treat still-present processlist COM_QUERY as disconnect leak (or severity/unique policy for hang vs orphan).
  4. Verify: After fix image, soak TPCH past q15 under dual-CN; found leak txn unique=0; pprof must not show multi-hour receiveMessage + runOnce pairs for the same Compile.

Workaround (ops)

KILL connection / session 019f9d3e-36bc-7bdb-a855-3a18c47d98d9 (or txn 18dd0759…e939) so TPCH can advance; does not fix root cause.

Activity

  1. added
    kind/bug
    severity/s0
    on Jul 27, 2026
  2. ghost removed
    severity/s0
    on Jul 27, 2026
  3. ghost added theissue type on Jul 27, 2026
  4. ghost added this to the MO-202607 milestone on Jul 27, 2026
  5. Repository owner unassigned on Jul 27, 2026
  6. ghost assigned on Jul 27, 2026
  7. aptend commented on Jul 27, 2026

    @aptend
    Contributor

    Root cause identified: terminal state can be lost as a receiver wakeup

    The #26202 hang and the residual vector UPDATE hang in #26125 are the same pipeline-lifecycle defect class.

    Root cause

    PipelineEdge has two representations of terminal state:

    1. the typed terminal signal delivered through Ch2; and
    2. the edge-wide terminal state exposed through Done() / Err().

    On a fatal terminal (Error / Abort), the edge records the fatal state and closes Done() before attempting to enqueue all required terminal signals into Ch2. If Ch2 is backpressured, the enqueue can time out or remain incomplete.

    However, PipelineSignalReceiver.listenToSingleEntry through listenToEightEntry wait only on:

    • receiver.usrCtx.Done(); and
    • reg.Ch2.

    They do not observe PipelineEdge.Done(). Therefore an edge may already be terminal while a receiver that did not obtain the terminal item remains blocked on Ch2 forever. The wait then propagates upward:

    PipelineSignalReceiver -> Merge / join
    RemoteRun receiveMessage
    Compile.runOnce
    frontend COM_QUERY
    

    This is why cancellation/cleanup can have happened without returning an error to the live SQL session.

    The hand-written 1–8-way select is not an input-count limit: more than eight entries use reflect.Select. The defect is the missing terminal-state wakeup in both paths, not the number of receivers.

    Fix direction

    The receiver must treat PipelineEdge.Done() as a lifecycle wakeup while preserving queued-data ordering:

    • drain any already-buffered Ch2 signals first;
    • once the channel has no queued signal, observe Done();
    • synthesize/propagate the recorded fatal terminal when the typed terminal item could not be delivered;
    • avoid a terminal-send wait cycle while holding the edge terminal-state lock.

    The same implementation covers #26202 on 4.2-dev and #26125 on main. Since a GitHub PR has one base branch, this should be one logical fix/patch with separate branch PRs (first 4.2-dev, then the same change forward-ported to main).

    Evidence for #26202

    The q15 session remains live while its execution tree is permanently split between PipelineSignalReceiver.GetNextBatch, messageSenderOnClient.receiveMessage, and Compile.runOnce. That stack is the expected terminal-wakeup failure shape, rather than a LockService wait or a slow operator.

    A regression should explicitly cover a fatal edge whose data channel is backpressured and verify that the receiver still exits through Done() / Err() instead of waiting indefinitely.

  8. assigned and unassigned on Jul 28, 2026
  9. ghost closed this as completedon Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugseverity/s-1

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions