Repository navigation
Description
Summary
LOAD DATA with compression='flate' on a large file (40M rows x 100 columns) hangs indefinitely for 2h44m until workflow timeout. The query never reaches the CN execution layer — it gets stuck at the planning/dispatch phase.
Environment
- Branch: main (commit b9efcce)
- Cluster: TKE, 3 CNs + 1 DN
- CN memory limit: 55 GiB
- Job: LOAD DATA TEST
- Namespace:
mo-main-commit-b9efcce38-20260709
Reproduction
load data url s3option {
'endpoint'='http://cos.ap-guangzhou.myqcloud.com',
'bucket'='mo-load-guangzhou-1308875761',
'filepath'='compressed_file/40000000_100_columns_load_data.flate',
'compression'='flate'
} into table test.table_100_columns
fields terminated by ',' lines terminated by '\n' parallel 'true';Timeline
04:22:56 LOAD DATA started
04:22:56 - 07:07:24 COMPLETELY SILENT (2h 44m)
- No CN logs about load/flate/compress
- No memory growth on any CN (stable 27-30 GiB)
- No goroutine growth (stable ~3100 per CN)
- No GC pauses (p75 < 1ms)
- DN shows 0 data written to table_100_columns
07:07:24 Job cancelled by workflow timeout
Comparison with other loads on the same table
| File | Rows | Compression | Duration | Status |
|---|---|---|---|---|
| 10000_100_columns.csv | 10K | none | 1.4s | OK |
| 100000_100_columns.csv | 100K | none | 7.4s | OK |
| 1000000_100_columns.csv | 1M | none | 35s | OK |
| 100000000_100_columns.csv | 100M | none | 4.9 min | OK |
| 40000000_100_columns.csv | 40M | none | 2.0 min | OK |
| 1000000_100_columns.csv.bz2 | 1M | bz2 | 3.3 min | OK |
| 40000000_100_columns.flate | 40M | flate | 2h44m (hung) | HANG |
Only flate compression causes the hang. Same data uncompressed or bz2-compressed loads fine.
Detailed Analysis
1. Memory — No growth during hang
CN tp-cn-stk5q: 33.1 GiB (04:20) -> 27.5 GiB (07:10) [dropped, no load activity]
CN tp-cn-5hbr6: 33.9 GiB (04:20) -> 28.5 GiB (04:30-07:00) -> 47.1 GiB (07:10, cleanup spike)
CN tp-cn-hrxmr: 34.4 GiB (04:20) -> 29.4 GiB (04:40-07:00) -> 38.6 GiB (07:10)
Memory was completely flat during the 2h44m hang period. If flate decompression were running, memory would grow.
2. Goroutines — No load-related goroutines
Queried Pyroscope goroutine profile for the hang period. Found zero goroutines in:
- flate decompression
- CSV parsing
- S3 file reading
- LOAD DATA import
- File decode/parse
Top goroutine stacks are all system background workers in normal select-wait state:
- 64K:
filterObjectWorker.Run(idle) - 33K:
concurrentExecutor.Run(idle) - 10K:
disttae.concurrentExecutor.Run(idle) - 9K:
dragonboat ssWorker(idle)
3. DN — No data written
DN logs show MergeExecutorEvent-L0Gather for table_100_columns with l0count:0 and ago: 10m15s — confirming no data reached the storage layer.
4. Proxy — Connection issues
Both proxy pods showed close connection failed errors every 5 seconds starting from ~04:29, suggesting the client connection was left dangling.
Root Cause
The LOAD DATA query is stuck at the query planning/dispatch phase before it reaches any CN worker for execution. The most likely cause:
- Query planner needs to read the flate file header from S3 to determine schema/column mapping
- The flate reader initialization blocks indefinitely (no read timeout on S3 HTTP request, or flate stream reader hangs)
- No timeout protection on the planning phase — the query waits forever
This is NOT:
- Memory pressure (memory is flat)
- GC issue (GC is normal)
- Goroutine leak (goroutines are flat)
- Data processing issue (no data was ever read)
Suggested Fix
- Add read timeout to the S3 HTTP client used for flate file header reading
- Add timeout protection to the LOAD DATA planning phase
- Add logging at the planning phase start so hangs are diagnosable
- Consider whether flate compression should be supported for large files, or add a size limit/warning
Activity
ck89119 commentedon Jul 9, 2026
根因调查结论
report 中的假设(planning 阶段读 flate 文件头导致 hang)不正确。 真正原因在执行阶段。
日志证据
在
tp-cn-stk5q上,LOAD 开始(04:22:56.241 UTC)后 55ms 即出现致命错误:紧接着持续狂刷(整个 hang 期间不停重试):
根因链
mcpu > 1→ 走compileExternScanParallelWrite(串行读、并行写 dispatch)#25537(本次测试 commit b9efcce)新引入的sameExecutionNode替代了旧的isSameCN:isSameCN:空地址Split("", ":")长度≠2 → 打 warning 后return true(容错为本地)sameExecutionNode:一空一非空 →return false(判为不同节点 → 生成 RemoteRegs 且 NodeAddr 为空)SendToAnyLocalFunc→ 报dispatch.go:98错误dial tcp4: missing address无限重试为什么其他 load 不复现
1mcpu==1→ 直接返回单 scope,不构造 dispatch>1compileExternScanParallelReadWrite,另一条构造路径,source 地址正确>1compileExternScanParallelWrite,source 地址为空结论
这与 flate 压缩类型无关,任何
mcpu > 1的压缩文件 LOAD 都会被 #25537(refactor(schedule): introduce staged query placement)引入的回归击穿。修复方向:让
compileExternScanParallelWrite中 source scope 的地址与 target merge scope 对齐。fix(compile): replace weak regression test with proper dispatch-level…
fix(compile): add LocalRegs assertion and fix trailing whitespace (ma…
chore: fix gofmt formatting in max_dop_test.go (matrixorigin#25554)
fix(compile): LOAD DATA with compressed file hangs due to empty dispa…
refactor(schedule): harden runtime worker scheduling (#25564)
Ariznawlll commentedon Jul 10, 2026
https://github.com/matrixorigin/mo-nightly-regression/actions/workflows/nightly-regression-tke-new.yaml
已恢复正常
fix(compile): LOAD DATA with compressed file hangs due to empty dispa…
refactor(schedule): harden runtime worker scheduling (matrixorigin#25564
fix(compile): LOAD DATA with compressed file hangs due to empty dispa…
refactor(schedule): harden runtime worker scheduling (matrixorigin#25564
fix(compile): LOAD DATA with compressed file hangs due to empty dispa…
refactor(schedule): harden runtime worker scheduling (matrixorigin#25564