Repository navigation
Description
Issue
sysbench1000w "Insert Duplicate 1000 threads" test fails with connection timeouts due to CN memory pressure. During the test, CN memory spikes to 40-41 GiB (close to the 55 GiB limit), triggering DN OOM alerts and cascading connection failures across the cluster.
Environment
| Field | Value |
|---|---|
| CI Run | https://github.com/matrixorigin/mo-nightly-regression/actions/runs/29940401960/job/89124090085 |
| MO Commit | 273400583d84d8da0ea2d61d9cb1c3dbd75db708 (4.2-dev) |
| Namespace | mo-branch-commit-273400583-20260723 |
| Cluster | TKE (3 CN + 1 DN + 2 Proxy) |
| Failure Time | 2026-07-23 06:24:24 - 06:31:37 UTC |
| Failed Step | Step 34: Start OLTP Insert Duplicate Test No Auto_increment With 1000 Threads |
Failure Details
Step 34 ran for 7 minutes (06:24:24 - 06:31:37 UTC) before timing out. The test normally completes in 5-7 minutes.
Error Messages
- CN service error (06:31:56 on CN
gr4jr):
cannot get salt, maybe not use proxy
error: read tcp 10.143.140.190:6001->10.143.140.182:49052: i/o timeout
- Proxy connection failures (06:31:50-55):
close conneciton failed
error: close tcp4 10.143.140.186:6001->10.128.1.138:42544: use of closed network connection
- DN OOM alerts (06:31:53-59):
MergeExecutorEvent-PauseDueToOOMAlert
available-mem: 0
Memory Usage at Failure Time
CN Pods (06:28-06:30 UTC peak):
| CN Pod | Peak Memory | Time |
|---|---|---|
7f25f |
41.4 GiB | 06:28 |
gr4jr |
40.8 GiB | 06:30 |
cznhr |
40.5 GiB | 06:25 |
DN Pod: 38.9 GiB peak at 06:31
Normal vs Failed Tests
| Test | Duration | Result |
|---|---|---|
| Read-Only 1000 | 5 min | ✅ |
| Random_points 1000 | 5 min | ✅ |
| Random_ranges 1000 | 5 min | ✅ |
| Read-Write 1000 | 5 min | ✅ |
| Write_only 1000 | 5 min | ✅ |
| Update-index 1000 | 5 min | ✅ |
| Update-Non-index 1000 | 5 min | ✅ |
| Delete 1000 | 5 min | ✅ |
| Insert 1000 | 13 min | ✅ |
| Insert Ignore 1000 | 7 min | ✅ |
| Insert Duplicate 1000 | 7 min | ❌ Failed |
Root Cause Analysis
Error Chain
CN memory spikes to 40-41 GiB (approaching 55 GiB limit)
→ DN detects memory pressure, triggers MergeExecutorEvent-PauseDueToOOMAlert (available-mem: 0)
→ CN service fails to allocate memory for new connections
→ CN reports "cannot get salt, i/o timeout" errors
→ Proxy detects closed connections: "close conneciton failed"
→ Sysbench client cannot establish new connections
→ Test times out after 7 minutes
→ Step 34 marked as failure
Why Insert Duplicate Specifically?
The "Insert Duplicate" test performs INSERT ... ON DUPLICATE KEY UPDATE operations with 1000 concurrent threads. This workload:
- Generates high memory pressure due to duplicate key checking and update operations
- Causes CN memory to spike to 40-41 GiB
- Triggers DN OOM protection (available-mem: 0)
- Results in cascading connection failures across the cluster
Other tests (Read-Only, Random_points, etc.) completed successfully because they generate less memory pressure.
Impact
- Test Reliability: Insert Duplicate test fails intermittently under high memory pressure
- Cluster Stability: Memory pressure causes cascading failures affecting all connections
- User Impact: Similar memory pressure issues could affect production workloads with high-concurrency INSERT operations
Related Issues
This is similar to previous sysbench1000w failures caused by memory pressure:
- Insert Ignore 1000 threads also took 7 minutes (longer than normal 5 min)
- Insert 1000 threads took 13 minutes (longer than normal 5 min)
- These tests show signs of memory pressure even when they don't fail completely
Suggested Investigation
- Memory Profiling: Profile CN memory usage during Insert Duplicate workload to identify memory allocation hotspots
- DN OOM Threshold: Investigate why DN triggers OOM alerts at 38.9 GiB (well below the 55 GiB limit)
- Connection Pool: Check if CN connection pool properly handles memory pressure scenarios
- Memory Limits: Review if 55 GiB is sufficient for high-concurrency INSERT workloads with 1000 threads
Logs
- CI Job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/29940401960/job/89124090085
- Namespace:
mo-branch-commit-273400583-20260723 - Failure Window: 2026-07-23 06:24:24 - 06:31:37 UTC
Activity
Ariznawlll commentedon Jul 23, 2026
Updated Root Cause Analysis
After re-analyzing the evidence, this is not purely a memory exhaustion issue, but rather a cascading failure triggered by DN memory pressure.
Key Evidence
MergeExecutorEvent-PauseDueToOOMAlert (available-mem:0)cannot get salt, i/o timeout— connection timeout, not memory allocation failureavailable-mem:0: DN's merge executor detected low memory, not CNRevised Error Chain
Why This Happens
The "Insert Duplicate" workload generates high memory pressure on the DN (not CN). The DN's merge executor detects
available-mem:0and pauses merge operations. Since merge is critical for storage operations (compaction, cleanup), this causes:Questions for Investigation
available-mem:0at 38.9 GiB? What is the DN's memory limit? Is the threshold too aggressive?INSERT ... ON DUPLICATE KEY UPDATEcompared to other INSERT operations?Suggested Next Steps
available-mem:0trigger at 38.9 GiB?Ariznawlll commentedon Jul 23, 2026
Root Cause Found: GOMEMLIMIT Misconfiguration
After further investigation, I found the real root cause: DN GOMEMLIMIT is set too low.
Configuration
The Problem
The DN was using 38.9 GiB, which is above the GOMEMLIMIT of 35 GiB. This caused:
available-mem:0to the merge executorMergeExecutorEvent-PauseDueToOOMAlertWhy GOMEMLIMIT is 35 GiB but container limit is 55 GiB?
This is a misconfiguration. The GOMEMLIMIT should be set closer to the container limit (e.g., 50 GiB) to allow the Go runtime to use more memory before triggering OOM alerts.
The current configuration:
The gap between 35 GiB and 55 GiB (20 GiB) is wasted - the Go runtime won't use it because it thinks it's running out of memory at 35 GiB.
Revised Error Chain
Suggested Fix
Increase DN GOMEMLIMIT from 35 GiB to 50 GiB (or closer to the container limit of 55 GiB).
This will allow the Go runtime to use more memory before triggering OOM alerts, preventing the cascade failure during high-load workloads like Insert Duplicate.
Configuration Locations
Workflow file:
.github/workflows/nightly-regression-on-tke.ymldn_gomemlimit: 35000MiBdn_gomemlimit: 50000MiBMO cluster config:
mo-bench-tke.yamlDN_GOMEMLIMIT35000MiB50000MiBImpact
This misconfiguration affects all high-load workloads that push DN memory usage above 35 GiB:
Verification
After increasing GOMEMLIMIT to 50 GiB, the DN should be able to handle high-load workloads without triggering OOM alerts, and the sysbench tests should complete normally.
ck89119 commentedon Jul 23, 2026
排查结论更新
我结合失败任务日志,以及 TKE Grafana 中的 Loki、Prometheus 和 Pyroscope 数据进行了排查,并与使用相同 MO commit、相同资源配置的上一次成功运行做了对比。
结论
现有证据不支持将 DN
GOMEMLIMIT=35 GiB认定为直接根因,此次失败也不是 OOM 或容器重启引起的级联故障。直接失败原因是:冷启动阶段出现极端长尾,5 条 duplicate insert 语句超过了客户端约 100 秒的 socket 超时。客户端断开后,对应 CN 上的语句才以
context canceled结束并回滚。随后负载恢复到 4.7k-7.7k TPS 并继续完成。任务失败仅仅是因为用例要求成功率必须为 100%。
证据
89124090085273400583d84d8da0ea2d61d9cb1c3dbd75db708mo-branch-commit-273400583-202607232026-07-23 06:25:53-06:31:36 UTCSUCCESS=901359,ERROR=5,TPS=3001,RT_MAX=86747 msCommunications link failure,距离最后一次收发数据约 100.1 秒。8966083、8264909、8022201),都是同一类INSERT ... ON DUPLICATE KEY UPDATEprepared statement,并在客户端超时后立即以context canceled结束。OOMKilled、cgroup OOM、exit 137、进程重启或容器重启;所有 CN/DN 的 restart counter 均为 0。与成功运行对比
上一次成功运行 29762051867,job
88479648594,使用了完全相同的 MO commit 和相同的资源/GOMEMLIMIT 配置。它的 Insert Duplicate 同样存在严重的冷启动长尾:
mo-branch-commit-273400583-202607202026-07-20 22:41:02-22:46:47 UTCSUCCESS=1063158,ERROR=0,TPS=3529,RT_MAX=89996 ms因此,merge throttling 和 DN 35 GiB GOMEMLIMIT 是相关的后台压力信号,但无法区分成功和失败运行,不能作为本次失败的直接根因。将 DN GOMEMLIMIT 提高到 50 GiB 也不会改变 merge scheduler 的 41.25 GiB 预算;同时 MatrixOne MPool/off-heap 内存不受 Go GOMEMLIMIT 约束,这样做反而可能提高 cgroup OOM 风险。
当前根因范围
目前能够复现和确认的边界是:1,000 并发线程下的冷缓存性能长尾具有波动性。
相关压力包括:
失败运行中,statement execution 超过 84 秒的事件明显多于成功运行,其中 5 条最终越过客户端超时边界。现有数据表明 txn admission、S3 read、remote lock 和 pipeline execution 都与压力相关,但还不足以把整个长尾归因于某一个函数。
建议后续分两部分处理:
冷缓存极端长尾的进一步结论
继续对齐 S3FS 慢日志、Prometheus 直方图、Pyroscope 阻塞栈、节点网络指标以及上述 MO commit 的源码后,极端长尾的直接机制已经基本收敛。
关键证据
io-read-all分位数分别达到p999=86.5s和p999=79.0s;成功运行三个 CN 的p999仅为32.0-36.8s。成功运行的普通冷读并不更快,但失败运行的极端尾部明显更厚。8966083:S3FS 读取耗时98.927s,请求约 32 KiB,取消前仅收到15,944字节;慢读日志后约0.4ms出现context canceled。8264909:S3FS 读取耗时88.598s,取消前收到约40.2 MiB;慢读日志后约0.6ms出现context canceled。8022201:S3FS 读取耗时88.327s,取消前收到约24.6 MiB;慢读日志后约0.8ms出现context canceled。S3FS.Read -> io.ReadAll -> net/http response body -> TLS Conn.Read -> netpoll,说明主要等待发生在 COS HTTP 响应体读取阶段,而不是 txn admission、lock acquire 或 pipeline。0.54%和0.72%,TcpExt_TCPTimeouts增量约为26和39;成功运行三个节点分别约为0.02%-0.31%和0-7。这些是节点级聚合指标,不能单独证明物理故障位置,但与慢 COS body 的时间和节点分布一致。file service retry、S3 connection failure 或 DNS failure。响应体读取处于停滞而未返回错误,因此现有重试逻辑没有被触发。对应源码机制
在 commit
273400583d84d8da0ea2d61d9cb1c3dbd75db708中:20s超时是ResponseHeaderTimeout,只约束等待响应头;http.Client没有整个请求或响应体读取超时。retryableReader,但只有底层Read返回错误时才会重试。如果 TLS socket read 一直没有返回,重试器无法介入。当前根因判断
建议验证与改进
http.Client.Timeout=20s。正常的 100 MiB 冷读本身可能需要 20-30 秒,超时应在持续无字节进展时触发,并利用现有 range reader 从已读 offset 续传。Ariznawlll commentedon Sep 4, 2026
最新 main 本地规模对照
origin/main:e6b25ee7726596514f520925815692c1a44031e1结果:最终行数 1,000、
SUM(v)=80,000,无执行错误、无丢更新;总耗时约 38.2 秒。该结果仅覆盖中等规模并发正确性,不能替代 issue 原始 1,000 线程/大数据量的 TKE 性能与稳定性验证,因此不据此关闭 #26088。
Ariznawlll commentedon Dec 2, 2026
结论
未完成验收。近期 4.2-dev 的同规模 Insert Duplicate 回归未复现原客户端超时,按当前观察先关闭,后续若再次出现同类问题再重新打开并补充证据。
关键证据
273400583d84d8da0ea2d61d9cb1c3dbd75db708;1000 线程存在 5 次客户端连接超时。后续排查认为 COS 响应体读取长尾与这些超时强相关,未证明 DN GOMEMLIMIT 是直接根因,详见调查。167a1a91999f43146393995286b8237a0f6e0942;准备 10 张表、每表 1000 万行,1000 线程执行 Insert Duplicate,成功 671335、错误 0、最大响应约 4.2 秒。该次测试配置 CN 内存上限 55Gi、DN 内存上限 32Gi,DN GOMEMLIMIT 20000MiB。待解决点
最终结论:未完成验收。已通过子项:近期同规模 1000 线程回归且未观察到原超时;未验收项:原拓扑和冷缓存网络长尾的匹配复验。根据当前不再复现的观察先关闭,后续复现再跟进。