Repository navigation
Labels
kind/bugSomething isn't workingseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Milestone
Description
Is there an existing issue for the same bug?
- I have checked existing issues. Related themes exist around session/txn cleanup, but not this Window pipeline cancel failure.
Branch Name
main
Commit ID
826a3e3d294ba62c7c4da217d1445f3c568ce4d9
Image: registry.cn-shanghai.aliyuncs.com/matrixorigin/matrixone:nightly-826a3e3d
Other Environment Information
- Hardware: single-node MO (docker, host port 16001), rootless docker on Linux
- OS: Linux
- Dataset: jinpan_001
- Suite: cases/jinpan_001/join_adv @q1004_adv_window_frame_running
- Client: mo-regression-test run.py --sql-timeout 1200 (func_timeout + side-connection KILL)
Actual Behavior
- Start a heavy Window +
UNION ALL+ outerLIMIT 200query over largedwd_s4_acdoca(seeq1004.sql). - Client hits 20-minute SQL timeout and issues cleanup:
Timeout cleanup: KILL QUERY <conn_id>
Timeout cleanup: KILL CONNECTION <conn_id>
KILLstatements return without error.information_schema.processliststill shows the sameconn_idasCOM_QUERYwith the original SQL.- In our run, the statement stayed active for 40+ hours (
run_sec ≈ 146700+), CPU still busy (~200%+ on the container), memory ~13GiB — no panic/OOM in CN logs. - Regression runner cannot advance to the next SQL because the server query / connection never finishes after the client-side timeout.
Manual retry also fails to stop it:
KILL QUERY 2208; -- no error
KILL 2208; -- no error
-- processlist still: conn_id=2208, command=COM_QUERY, same query_startOnly docker restart of the MO container clears the session.
Expected Behavior
KILL QUERY <id>cancels the running statement promptly.KILL CONNECTION <id>/KILL <id>disconnects the session and aborts the pipeline.- After a successful KILL, the conn_id must disappear from
processlist(or move out ofCOM_QUERY) within a short time. - Client timeout paths that issue KILL must be able to reclaim the CN and continue other work.
Steps to Reproduce
- Use nightly image
matrixone:nightly-826a3e3dwith jinpan_001 loaded (or any large table reproducing a multi-minute Window query). - In session A, run
q1004.sql(Window over ~16M filtered rows, duplicated underUNION ALL, outerLIMIT 200). - Note
conn_idfromSHOW PROCESSLIST/information_schema.processlist. - In session B:
KILL QUERY <conn_id>;
-- and/or
KILL CONNECTION <conn_id>;
KILL <conn_id>;- Re-check processlist: query is still
COM_QUERYwith the samequery_start. - Observe it continues for a long time (in our case >40h until container restart).
Repro SQL
Same as join_adv q1004 (full text in q1004.sql). Shape:
SELECT u.* FROM (
SELECT * FROM ( /* window over acdoca ~16M rows */ ) a
UNION ALL
SELECT * FROM ( /* identical window query */ ) a
) u
LIMIT 200;Additional Context / Evidence
| Time (CST) | Event |
|---|---|
| 2026-07-21 18:36:20 | Query start (conn 2208) |
| 2026-07-21 18:56:20 | Client timeout; KILL QUERY/CONNECTION 2208 logged |
| 2026-07-23 11:21+ | Same conn 2208 still COM_QUERY, run_sec≈146700 |
- Plan type:
AP QUERY PLAN ON ONE CNwith nestedWindow+PartitionunderUnion All(see companion enhancement issue on LIMIT/UNION short-circuit). - No matching panic/fatal for this statement_id in docker logs during the hang window.
- Separate enhancement issue covers optimizer/efficiency; this issue is specifically about cancel not working.
Impact
- Makes per-SQL timeouts useless for this class of query.
- Blocks entire join_adv / long-running regression suites (one uncancellable SQL freezes the worker).
- Requires container restart to recover — unacceptable for shared CI clusters.
Suggested direction (for implementers)
- Ensure Window / Partition / merge pipeline operators periodically check cancel context.
- Make
KILL QUERYmark the session aborted even if an operator is inside a long sort/spill. - Add a regression test: start a long Window query, KILL it, assert processlist clears within N seconds.
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Activity
XuPeng-SH commentedon Jul 24, 2026
Additional independent reproduction on 2026-07-24, local standalone MatrixOne commit
9c2e84ad5c, TPCH SF10:While exploring a single-evaluation rewrite for TPCH Q15, this valid Window+CTE shape became CPU-bound for more than 30 seconds despite the canonical Q15 finishing in about 0.55 s hot:
I reproduced it twice, once through
EXPLAIN ANALYZEand once as a plain query. After the clients disconnected/timed out, both connection IDs remained active ininformation_schema.processlistand continued consuming about 200% CPU.KILL QUERYfollowed byKILL CONNECTIONreturned but did not stop either pipeline. Restarting the standalone service was required to recover.This is consistent with the Window pipeline cancellation defect described here and shows it does not require
UNION ALLor the jinpan dataset. I filed the separate CTE recomputation opportunity as #26131; the cancellation failure belongs here.jiangxinmeng1 commentedon Jul 24, 2026
fixed by #26080
perf(plan): reuse eligible multi-reference CTEs (#26331)
perf(plan): reuse eligible multi-reference CTEs (matrixorigin#26331)
perf(plan): reuse eligible multi-reference CTEs (matrixorigin#26331)
perf(plan): reuse eligible multi-reference CTEs (matrixorigin#26331)