Repository navigation
Description
Description
在最新 MatrixOne main 的 Big Data 10Y 测试中,1B INSERT INTO ... SELECT ... 向带复合主键、二级索引和唯一索引的目标表写入时,COS multipart upload 返回 http: server closed idle connection。服务端已经记录 SQL 失败,但没有及时将错误返回客户端,相关事务持续被报告为 found leak txn,会话最终挂到客户端超时退出。
Environment
- Branch:
main - Commit:
46950ae0bd00e5a504445865abb6448f9dbefced - Deployment: TKE,3 CN(14C/55GiB)+ 1 TN(14C/55GiB)+ 3 Log + 2 Proxy
- Namespace:
mo-big-data-commit-46950ae-suite-10y - Test: Big Data 10Y run 33284942789 / job 99227536060
Steps to reproduce
目标表约 10 亿行,包含复合主键、普通二级索引和唯一索引:
CREATE TABLE big_data_test.table_with_com_pk_index_for_insert_1B (
id BIGINT,
col1 TINYINT,
-- 其余 24 列省略
PRIMARY KEY (id, col1),
KEY (col3, col4),
UNIQUE KEY (col4)
);
INSERT INTO big_data_test.table_with_com_pk_index_for_insert_1B(
id,col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11,col12,
col13,col14,col15,col16,col17,col18,col19,col20,col21,col22,col23,col24,col25
)
SELECT *
FROM big_data_test.table_with_pk_for_load_1B
WHERE col4 != -7508478199581380391;预期写入 999999998 行。
Actual behavior
以下时间均为 UTC:
-
10:14:43:CNnightly-regression-dis-tp-cn-lx6xx接收连接9699,session01a0522a-0d3a-72bd-84e1-28b5f64a46e2,开始执行 INSERT。 -
10:52:37起:CN 每 20 分钟报告该会话的事务2474ed21381a480e18d07e55422417b3为found leak txn。 -
11:45:38:remote pipeline 连续报告:connector cleanup timed out sending terminal Error signal pipeline_failed=true http: server closed idle connection -
11:45:41:服务端已经将 INSERT 记录为失败:Post "https://mo-nightly-gz-1308875761.cos.ap-guangzhou.myqcloud.com/ mo-benchmark-33284942789/data/..._00000?uploads": http: server closed idle connectionstatement id:
01a0522a-0ffc-7b38-bdbb-94bad8105cb4。 -
同一会话随后继续残留事务
2474ed21381a480e18d07e55422442e8,CN 在12:12、12:32、12:52、13:12持续报告found leak txn;13:22:27才记录Exec.Run : 1h36m45.535s。 -
客户端没有收到
11:45:41已产生的真实错误,只在12:14:43达到 7200 秒后报测试侧 execution timeout。 -
测试随后在同一连接执行
SELECT COUNT(*),再次等待 7200 秒;直到14:14:43测试进程退出,CN 才清理连接9699。
相关四小时窗口内没有 OOM、exit 137 或 panic。
Expected behavior
- COS multipart upload 的 transient idle-connection failure 应按 fileservice retry 策略重试;重试耗尽时应立即向 SQL 客户端返回原始错误。
- remote pipeline cleanup 不应吞掉 terminal Error 或让 SQL 一直等待到客户端超时。
- SQL 失败后相关 txn、锁和 session 应立即 rollback/释放,不应持续产生
found leak txn。 - 后续连接或查询不应被前一条失败语句拖死。
Stability and controls
- Reproducer: 本次 nightly
1/1复现;单次 case 占用 4 小时,尚未连续执行 3 次。 - Controls: 同一 run、同一数据源和集群中,Basic Insert(约 4m41s)、PK Insert(约 38m)、PK Index Insert(约 1h30m)、Sortkey Insert(约 7m42s)、Alter Insert(约 3m35s)均完成。
- Failure atomicity/data check: INSERT 未向客户端返回终态,后续
COUNT(*)也在同一会话超时,因此本次无法确认目标表最终行数;这正是需要修复的失败后状态不可观测问题。 - Resource control: 相关窗口没有 OOM、exit 137 或 panic,不是 CN 被杀或内存崩溃。
Evidence
- GitHub Actions: job 99227536060
- Client SQL start:
2026-08-30 10:14:43 UTC - Server-side original failure:
2026-08-30 11:45:41 UTC - Client-side timeout:
2026-08-30 12:14:43 UTC - Session cleanup:
2026-08-30 14:14:43 UTC - CN:
nightly-regression-dis-tp-cn-lx6xx - Connection/session:
9699/01a0522a-0d3a-72bd-84e1-28b5f64a46e2
Code analysis
已确认:
- 服务端真实失败来自 qcloud/COS multipart upload 初始化请求(
?uploads)。 pkg/sql/compileremote connector cleanup 无法发送 terminal Error,日志明确记录connector cleanup timed out sending terminal Error signal。- frontend 已记录 INSERT
status=fail,但客户端没有收到该错误;同一会话的事务继续被 leak checker 报告。
待研发确认的推测:
pkg/fileservice对server closed idle connection的 retry 可能没有覆盖 multipart upload 初始化阶段,或错误在上层转换后绕过 retry 判断;- remote connector 的接收方退出或 channel 不可写后缺少可靠的错误 fallback,导致 frontend/客户端等待链没有结束;
- pipeline 失败后的 transaction rollback/cleanup 依赖 terminal signal 完成,signal 丢失后事务持续存活。
Regression coverage
修复后应保留 Big Data 覆盖,并增加可控的小规模故障注入测试:在 multi-CN INSERT INTO SELECT 的 COS multipart upload 阶段注入一次 server closed idle connection,断言:
- 可重试时 SQL 最终成功;
- 重试耗尽时客户端收到原始 COS 错误,而不是超时或
context canceled; - 失败后目标表无部分提交;
- 同一连接可继续执行
SELECT 1; - 不产生持续的
found leak txn。
Related
- LOAD DATA fails with COS
server closed idle connectiondue to fileservice forcibly closing idle connections #25350:相同 COS 错误,但该问题主要记录 LOAD DATA/fileservice 主动关闭 idle connection;本问题发生在 fix(fileservice): avoid closing idle upload connections #25458 合入后的当前main,并额外包含 remote error 无法返回、txn leak 和会话挂死。 - [Bug]: multi-CN remote pipeline can report duplicate-key INSERT as success #27115 / fix(compile): preserve remote pipeline error causes #27150:处理部分 distributed pipeline 原始错误传播问题;本次 COS upload cleanup 路径仍挂住。
- [Bug]: distributed INSERT SELECT can replace foreign-key violation with context canceled #27524 / fix: preserve primary error across join map cancellation #27614:处理 join-map cancellation 覆盖主错误;本问题不是错误被
context canceled替换,而是错误没有终结客户端等待和事务生命周期。
Activity
ck89119 commentedon Aug 31, 2026
Please help verify this issue @Ariznawlll
Ariznawlll commentedon Sep 3, 2026
还没跑。明天更新结果
Ariznawlll commentedon Sep 5, 2026
main commit : fa829e5
https://github.com/matrixorigin/mo-nightly-regression/actions/runs/33891010490/job/101136496596
已修复