You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: MODUMP max_file_size panics with 'cannot create context from nil parent' when splitting large results #30552
Topology: single-node standalone (./mo-service -launch etc/launch/launch.toml, LOG+TN+CN single process)
OS: macOS
Actual Behavior
MODUMP QUERY_RESULT ... INTO ... max_file_size <small> panics with internal error: panic cannot create context from nil parent whenever the exported result is large enough to trigger file splitting.
ERROR 20101 (HY000) at line 1: internal error: panic cannot create context from nil parent:
context.withCancel
golang.org/x/sync/errgroup.WithContext
github.com/matrixorigin/matrixone/pkg/frontend.init.func52
...
The panic is recovered (the server stays alive) but the export fails every time, so max_file_size splitting is completely unusable on large results.
Root cause (source level): pkg/frontend/export.go:205 does ep.AsyncGroup, _ = errgroup.WithContext(ctx). For the MODUMP path the ctx passed into openNewFile originates from execCtx.reqCtx, which is nil for this statement type, so errgroup.WithContext(nil) panics.
Steps to Reproduce
createdatabasemd;
createtablemd.big (id int auto_increment primary key, val int);
insert intomd.big (val) values (1);
-- double until ~2048 rows (11 doubling inserts)set save_query_result=on;
/* save_result */select*frommd.bigorder by id;
select last_query_id(); -- capture the id-- this panics:
modump query_result '<id>' into '/tmp/out.csv' max_file_size 1;
-- this works (no split triggered):
modump query_result '<id>' into '/tmp/out.csv' max_file_size 100000;
Reproduced 3/3 times on separate standalone instances; behaviour is deterministic.
Expected Behavior
max_file_size should split the output into multiple files without panicking. A nil context must never reach errgroup.WithContext.
Additional information
The server does not crash (panic is recovered and surfaced as internal error), but the export always fails.
Checked duplicates: #8484 (modump execute error, closed) and #13681 (result_scan union empty, closed) are different symptoms.
The panic fires specifically on the first file rotation (when the output exceeds max_file_size and the exporter tries to open the second split file):
max_file_size 1 with an ~1.6KB result → the first split file split.csv (1020 bytes ≈ 1KB, 5 rows) IS written, then the rotation to file integrate mysql parser from pingcap #2 hits errgroup.WithContext(nil) and panics.
So the first split chunk is produced correctly; the nil-context panic occurs on openNewFile for the subsequent chunk. This narrows the fix to the per-rotation openNewFile call (the ctx/reqCtx is nil only on the rotation path, not the initial open).
Activity
Ariznawlll commentedon Oct 19, 2026
Refined trigger condition
The panic fires specifically on the first file rotation (when the output exceeds
max_file_sizeand the exporter tries to open the second split file):max_file_size 1with an ~1.6KB result → the first split filesplit.csv(1020 bytes ≈ 1KB, 5 rows) IS written, then the rotation to file integrate mysql parser from pingcap #2 hitserrgroup.WithContext(nil)and panics.So the first split chunk is produced correctly; the nil-context panic occurs on
openNewFilefor the subsequent chunk. This narrows the fix to the per-rotationopenNewFilecall (thectx/reqCtxis nil only on the rotation path, not the initial open).fix: address review on result_save/scan chain PR
frontend: fix result save/scan chain issues (#30552 #30553 #30571) (#…
Ariznawlll commentedon Oct 22, 2026
测试版本
75ae9a79d626622e6ccec0bcb28412f5fcf84c7f,是该轮执行时核对的官方 main;发布评论时 main 已前进,本评论不声称测试过后续提交。9f7fe43649b3eb9e34f1bc4073ecbc03c6e2a2a3已核实位于上述测试 SHA 的祖先链。原问题验证
保存实际查询结果并动态获取 query ID;2048 行,每行包含唯一 id、200 字符文本及 DATE。执行
MODUMP QUERY_RESULT ... MAX_FILE_SIZE 1,连续 3/3 轮完成,实际产生至少两个文件,无首次轮转 panic。逐文件 CSV 解析并与独立构造的全部 2048 条预期记录比较,无缺失、重复或错值。Happy Path 覆盖
MAX_FILE_SIZE 100000生成恰好一个文件,同样逐行核对全部 2048 条记录通过。result_scan行数为 2048;原表行数 2048、id 合计 2098176,完整文本和日期均未变。Unhappy Path 覆盖
SELECT 1正常;清理后临时文件目录和测试数据库均不存在,连接关闭。白盒验证
本次新增回归不导入 MatrixOne 内部源码,不用内部 mock 替代产品路径;通过实际服务的 SQL/客户端协议及导出文件断言。本次 MOTR 迁移验证未新增或重跑内部 Go/race 测试。
回归测试
已提交独立 MOTR PR #258,head
e8a012246457624f7091c44f6d3445a4ebab1f48;从官方 MOTR main 建立,不追加 #247,也没有新建 MO 仓库 PR。该回归 PR 目前 OPEN,未声称已合入。测试证据
本地原始日志:
/tmp/mo-seven-qa-jc6Q4H/motr-migration-final.log,最终汇总total=6 success=6 failed=0 skipped=0、耗时 13.00s,任务自有服务退出码 0。离线日志:motr-migration-offline.log。本地文件不是已上传的 GitHub artifact;可公开检查的测试实现见上述固定版本链接及 PR。本结论限定为上述 main SHA 的本 issue 原问题及所列边界;不代表 4.2 发布线、完整集成 CI 或所有分布式场景已通过。
测试结论
测试通过。