Description
Summary
Nightly run stuck for more than 5 hours in IVF PRE POST FILTER VECTOR RECALL TEST, specifically at step Recall l2_only pre-filter.
This does not look like a GitHub runner issue, pod restart, OOM, or RPC queue blockage. Metrics and profiles point to severe read amplification in MO while executing IVF l2_only pre-filter recall on the 10M wiki dataset.
Failed/stuck step
Workflow step:
python run_wiki.py recall --config "${WIKI_CFG}" \
--sql-mode l2_only --filter-mode pre \
--gt-source ann -n "${WIKI_N}" -k "${WIKI_K}" --concurrency "${WIKI_CONCURRENCY}" \
| tee "${GITHUB_WORKSPACE}/wiki_recall_l2_only_pre.log"Parameters:
WIKI_N=10000
WIKI_K=10
WIKI_CONCURRENCY=100
The generated SQL shape is:
SELECT file_id, id
FROM historical_file_blocks_wiki_ivfflat10m
ORDER BY l2_distance(embedding, ?) ASC
LIMIT 10
BY RANK WITH OPTION 'mode=pre';The benchmark client uses ThreadPoolExecutor(max_workers=100) and waits through as_completed(...) without a per-query timeout. If some queries become extremely slow or stuck, the whole CI step waits until the workflow timeout.
Environment
- MO image/version:
commit-516e55d88 - Namespace:
mo-main-commit-516e55d88-20260611 - MO service IP:
172.16.96.178 - Pods:
- DN:
nightly-regression-dis-dn-0 - CNs:
nightly-regression-dis-tp-cn-2g287,nightly-regression-dis-tp-cn-j74fr,nightly-regression-dis-tp-cn-w5h4b
- DN:
Metric evidence
Window: from 2026-06-12 08:43:02 CST, when Recall l2_only pre-filter started.
Basic health checks:
- Pod restarts:
0for CN/DN/proxy - RPC write queue:
0 - Cache pressure: nearly
0
CN CPU shortly after recall started:
tp-cn-j74fr: peak13.908cores at08:53 CSTtp-cn-w5h4b: peak13.876cores at08:53 CSTtp-cn-2g287: peak13.812cores at08:53 CST
Container filesystem read throughput:
tp-cn-2g287: peak2342.9 MiB/sat09:08 CSTtp-cn-j74fr: peak2139.9 MiB/sat09:08 CSTtp-cn-w5h4b: peak1994.5 MiB/sat09:08 CST
MO FS read rate:
tp-cn-w5h4b: peak11581.574 ops/sat09:08 CSTtp-cn-j74fr: peak9954.574 ops/sat09:08 CSTtp-cn-2g287: peak8986.163 ops/sat09:08 CST
Pipeline/statement duration also spiked soon after recall started:
mo_pipeline_server_duration_seconds5-min avg peak:tp-cn-j74fr:49.525stp-cn-w5h4b:48.571stp-cn-2g287:42.732s
mo_txn_statement_duration_seconds{type="execute"}5-min avg peak:tp-cn-j74fr:14.191stp-cn-2g287:10.035stp-cn-w5h4b:9.076s
DN also had heavy background read/merge activity:
- DN S3/network read peak: about
741 MiB/s - DN cache evict peak: about
34 ops/s
Profile evidence
Pyroscope CPU profile window: 2026-06-12 08:43:02 CST to 2026-06-12 14:45:00 CST, before manual profiling polluted the runtime.
CN hot paths were dominated by table scan/read/projection/top rather than IVF search itself:
tp-cn-2g287- self CPU:
runtime.memmove37.47%,internal/runtime/syscall.Syscall625.04% - total hot paths:
table_scan.(*TableScan).Call61.64%,blockio.BlockDataRead61.60%,BlockDataReadInner60.44%,readutil.(*reader).Read61.63%,top.(*Top).Call61.64%
- self CPU:
tp-cn-j74fr- self CPU:
runtime.memmove39.86%,internal/runtime/syscall.Syscall626.59% - total hot paths:
table_scan.(*TableScan).Call65.72%,blockio.BlockDataRead65.52%,BlockDataReadInner64.43%,readutil.(*reader).Read65.69%,top.(*Top).Call65.50%
- self CPU:
IVF-related functions are present in the profile, but they are not the dominant CPU path:
table_function.(*ivfSearchState).starttable_function.runIvfSearchVectorivfflat.(*IvfflatSearch).Searchivfflat.(*IvfflatSearchIndex).Searchblockio.HandleOrderByLimitOnIVFFlatIndexvectorindex/metric.L2DistanceSq
DN profile shows heavy merge/read activity at the same time:
mergeObjectsTask.Execute:80.73%mergeObjectsTask.LoadNextBatch:73.81%mergesort.DoMergeAndWrite:80.45%mergesort.mergeObjs:80.44%fileservice.(*readCloser).Read:143.24%
Conclusion
The stuck step is caused by MO-side execution behavior for IVF l2_only pre-filter recall. Under 100 concurrency on the 10M wiki dataset, the query path triggers very high CN read amplification. CN profiles are dominated by TableScan -> BlockDataRead/readutil -> Projection -> Top, with memmove and syscall cost very high. DN is also doing heavy merge/S3 read work concurrently, which likely worsens IO pressure.
This is not caused by runner failure, pod restart/OOM, RPC queue blockage, or cache pressure. The benchmark step then appears to hang because the client has no per-query timeout and waits for all futures to finish.
Expected behavior
l2_only pre-filter recall should complete within a bounded time, or the execution plan should avoid falling back to a high-read table-scan/top path for this workload.
Suggested next steps
- Check why
BY RANK WITH OPTION 'mode=pre'forORDER BY l2_distance(...) LIMIT 10still spends most CPU in table scan/block read/projection/top. - Check whether IVFFLAT pre-filter path is reading too many blocks or failing to prune candidates effectively.
- Consider adding server-side/query timeout protection for this vector recall workload.
- Consider adding client-side per-query timeout in the benchmark to avoid CI hanging for many hours when individual queries are stuck.
Activity
Ariznawlll commentedon Jun 12, 2026
Additional code-level analysis for the four follow-up questions:
1. Why does
BY RANK WITH OPTION 'mode=pre'still spend most CPU intable_scan / BlockDataRead / projection / top?For the failing case, the benchmark mode is
l2_only. Its SQL template has no normal filter predicate:In the planner,
mode=preonly enables the pre-filter nested join path when the original scan still has filters:Source:
pkg/sql/plan/apply_indices_ivfflat.go.There is also a unit test that explicitly documents this behavior:
NoFilters_DisablePushdownusesrankOption: mode=pre, but verifies the plan is:instead of the nested pre-filter join.
So in this workload,
mode=preis syntactically present, but becausel2_onlyhas noWHEREfilter, there is no pre-filter candidate set to build. The query therefore still spends time in scan/read/top paths.2. Is IVFFLAT pre-filter reading too many blocks or failing to prune candidates effectively?
For this exact failing
l2_onlycase, the pre-filter membership path is not active.ivfflat.getBloomFilter()returns immediately if there are no runtime filter specs:Without a runtime membership filter, IVFFLAT uses the standard centroid path:
That internal
ORDER BY vec_dist LIMITcan be pushed into the entries table scan asIndexReaderParam. The reader path then callsHandleOrderByLimitOnIVFFlatIndex, which loops over selected rows, decodes vector bytes, computes distance row by row, and maintains a TopK heap.This matches the profile:
TableScan -> BlockDataRead/readutil -> Projection -> Top, with heavyruntime.memmoveand syscall cost.Therefore the concrete issue seen here is not “pre-filter membership pruning failed”, but:
l2_onlyhas no filter, so pre-filter membership pruning is bypassed by design.3. Server-side timeout protection
There is a
max_execution_timesystem variable definition, but code search only found the variable definition, not execution-time enforcement that wraps query execution context with a deadline. So it does not currently look like this workload is protected by a real statement timeout.Relevant finding:
pkg/frontend/variables.godefinesmax_execution_time, default0.context.WithTimeoutfor normal SQL execution.So adding server-side protection would require wiring a real query deadline into the frontend/compile/process context, or adding a targeted timeout/cancellation guard for vector index internal SQL.
4. Client-side benchmark timeout
The benchmark client also has no per-query timeout.
In
eval_vector_search_from_table.py:l2_onlytemplate has noWHEREfilter.pymysql.connect(**DB_CONFIG)without defaultread_timeout/write_timeout.ThreadPoolExecutorandas_completed(future_to_i)without timeout.If one or more SQLs become extremely slow or stuck, the process keeps waiting for those futures, so the GitHub Action step can hang for hours until workflow timeout.
Current conclusion
The immediate cause of the 5h stuck step is:
l2_only + mode=predoes not actually activate pre-filter membership pruning because there is noWHEREfilter. The query falls back to the normal IVF centroid entries path, whereORDER BY vec_dist LIMITis executed through scan/block-read/distance-calculation/top-k logic. Under 100 concurrency on 10M wiki data, this causes severe CN read amplification. The benchmark then has no client-side query timeout, so slow/stuck queries hang the CI step.Recommended fixes:
ORDER BY vec_dist LIMIT 10, especially withprobe_limitand 100 concurrency.mode=prebehavior for no-filter SQL. If no pre-filter can be built, EXPLAIN/logs should make that obvious.read_timeout/ fail-fast behavior so CI reports a bounded failure instead of hanging for hours.aunjgr commentedon Jun 12, 2026
昨天进去的PR都跟ivf不相关。最近的相关PR是上周的 #24787 。等一下看今晚的nightly能否复现
Ariznawlll commentedon Jun 13, 2026
Additional goroutine analysis from a newer hung run. This points to a pipeline cleanup hang, not only a slow table scan issue.
New hung run
Run: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/27426252619
Job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/27426252619/job/81125307035
The stuck step in this run is different from the original
l2_only pre-filtercase. This time it stopped at:Timeline:
SQL shape printed by the benchmark:
Goroutine dump summary
The uploaded
goroutine.zipcontains 6000 CN goroutine dumps. The dump timestamps are:So these dumps were collected about 1 hour 40 minutes after the GitHub step was cancelled, not exactly at the cancellation time. However, they still contain long-running SQL goroutines whose start time falls inside the
Recall l2_filter pre-filterwindow.The most important finding is on CN
38653536-6362-6534-3235-626632363730: several frontend SQL goroutines were stuck for a very long time.For example, in the 09:58:06 dump, three SQL goroutines have the following stack:
09:58:06 minus 165 minutes is around 07:13 CST, which is inside the
Recall l2_filter pre-filterexecution window. This means these are not just idle background goroutines; they are SQL requests that did not return from the server side.The corresponding worker goroutines are stuck during pipeline cleanup:
This matches the code path:
Conclusion
The direct hang point shown by the goroutine dump is not simply
TableScanorBlockDataReadbeing slow. The hour-level hang is:In other words, some IVFFLAT recall queries never returned because MO got stuck during pipeline cleanup. The stuck point is
Merge.Reset -> PipelineSignalReceiver.WaitingEnd. This blocksCompile.runOnce, then blocksfrontend.doComQuery, and finally causes the benchmark client to wait forever for unfinished futures until the GitHub Actions step is cancelled.The dump also contains many IVFFLAT/pre-filter related execution stacks, so the workload is still exercising the expected scan/hash/runtime-filter/IVFFLAT path:
But these
TableScan,BlockDataRead,HashBuild, andReceiveMessagestacks mostly have short goroutine state durations, usually around 1~3 minutes. They show the active workload shape, but they are not the direct hour-level hang point. The direct hour-level hang is the frontend query waiting on pipeline cleanup.Useful goroutine files to inspect
Most useful file:
This file contains three
doComQuery [chan receive, 165 minutes]goroutines and the correspondingPipeline.Cleanup -> Merge.Reset -> WaitingEnd [select, 164 minutes]worker stacks.Neighboring dumps from the same CN, useful for confirming that the same query stayed stuck across samples:
Representative runtime-filter / hash / table-scan stacks:
Representative IVFFLAT top-k stack plus frontend waiting stack:
CN_38653536-6362-6534-3235-626632363730_goroutine_019ebe9f-0f98-75bc-b74b-147c222ff6ab.gz
CN_38653536-6362-6534-3235-626632363730_goroutine_019ebe9f-84f4-7e7f-9609-ad19ff7ea40f.gz
CN_38653536-6362-6534-3235-626632363730_goroutine_019ebea0-6f3e-79a2-a50e-c7126e74d137.gz
CN_38653536-6362-6534-3235-626632363730_goroutine_019ebea0-e455-75be-86be-20344ed2fdeb.gz
CN_38653536-6362-6534-3235-626632363730_goroutine_019ebea1-5987-7bbb-b481-275eebd10d90.gz
fix: bound pipeline cleanup waits (#24972)
1 remaining item
fix: bound pipeline cleanup waits (matrixorigin#24972)
fix: bound pipeline cleanup waits (matrixorigin#24972)
Ariznawlll commentedon Aug 22, 2026
Regression observed in 2026-08-22 nightly
This issue has regressed and is being reopened. The same 10M Wiki IVF-FLAT workload again hangs in the first `l2_only` + `mode=pre` recall phase.
The failing query shape is:
```sql
SELECT file_id, id
FROM jst_app_wiki.historical_file_blocks_wiki_ivfflat10m
ORDER BY l2_distance(embedding, ?) ASC
LIMIT 10 BY RANK WITH OPTION 'mode=pre';
```
Actual behavior
The S3 data load and IVF-FLAT index build completed successfully:
The following recall then ran at only about `0.48 QPS`:
```bash
python run_wiki.py recall --config "${WIKI_CFG}" \
--sql-mode l2_only --filter-mode pre \
--gt-source ann -n 10000 -k 10 --concurrency 100
```
After roughly one hour it had completed only `1720/10000` requests. The job was cancelled by its configured `timeout-minutes: 200` before the first recall pass completed, so the remaining pre/post-filter scenarios and final `EXPLAIN ANALYZE` were not executed.
The job log contains no MO panic, OOM, connection failure, or index-build failure.
Passing control
The previous nightly run used the same vector benchmark commit and the same workload parameters, but an earlier MatrixOne commit:
The current run is therefore about 46x slower (`0.48 QPS` vs `20.25 QPS`). At the current throughput one recall pass needs roughly 5.8 hours, so raising the CI timeout would only mask the regression.
Code correlation
The current product commit contains #27297, while the passing control does not. That PR replaced the query-time IVF search TVF with the optimizer-visible `VECTOR_INDEX_SCAN` path.
This is a strong regression candidate, not yet a line-level root cause: the failed job did not reach its final `EXPLAIN ANALYZE`, so the current evidence cannot prove whether the new path misses index pruning, expands the candidate scan, or blocks in distributed execution.
Expected behavior
The 10M IVF-FLAT `l2_only` recall should complete in a bounded time comparable to the previous control run, without leaving the benchmark waiting for long-running SQL futures until the workflow is cancelled.
Suggested verification
Ariznawlll commentedon Aug 22, 2026
Re-closing this historical issue to preserve its resolved status after #24972.
The current failure is being tracked as a new regression in #27474 because it appears after the later `VECTOR_INDEX_SCAN` refactor #27297. The new issue contains the current main commit, baseline comparison, and nightly evidence.
fix: bound pipeline cleanup waits (matrixorigin#24972)
fix: bound pipeline cleanup waits (matrixorigin#24972)
fix: bound pipeline cleanup waits (matrixorigin#24972)