Repository navigation
Closed
Labels
kind/bugSomething isn't workingseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Milestone
Description
问题描述
2026-10-27 main TKE Family 周回归中,SIFT128 100 万向量的 HNSW 索引创建成功,但后续 100 并发、5 分钟近邻查询出现 326 次 MatrixOne 服务端资源错误,导致该用例失败。这是现有回归负载下的非预期 SQL 失败,需跟踪定位;目前不能认定为内存泄漏或特定提交引入。
环境与复现
- 回归:run 40349960473 / TP Tail job 121834219521;测试仓库 SHA e648b56ffb824d849b3aaaa8ae2bc164c945454d。
- 实际测试 MatrixOne SHA:6c1942f3cf0d4b967864dcc1d67b7884164a2fdb(main);TKE weekly-shadow-1x2,1 TP CN + 2 AP CN,namespace mo-main-family-40349960473-1。
- TP CN 容器内存上限 55 GiB,GOMEMLIMIT=25000MiB,CN cache=16GiB。GOMEMLIMIT 不等同于 SQL 执行内存上限。
- 使用 /vector/sift/sift_base.fvecs 加载 100 万条 128 维向量;在 ann.items_sift(embedding) 上创建 HNSW 索引,M=8、EF_CONSTRUCTION=200、EF_SEARCH=64、vector_l2_ops,索引创建成功。
- 100 个终端运行 5 分钟,查询模式:SELECT id FROM ann.items_sift ORDER BY l2_distance(embedding, <128维查询向量>) LIMIT 1。该 Family 流程同时运行 CDC、MOTR 等负载;是否由共置负载推高内存尚未确认。
实际结果
- 开始约 98 秒后出现错误;本轮查询成功 384,227 次,失败 326 次,报告 QPS=-1、RESULT FAILED。不能把 326 次错误当作 326 次独立的回归复现。
- 其中 320 次为错误码 3015:resource exhausted: merge top memory capacity exceeded; reduce LIMIT or query concurrency, or increase processLimitationSize。
- 另 6 次为 resource exhausted: hash build memory budget exceeded(requested=16384,used 约 26.0–26.75 GB,effective limit 几乎贴近 used)。
- HNSW 建索引步骤成功;同一 job 后续 3 个 IVF SIFT 用例通过。最终 Enforce planned Vector SIFT outcomes 因 expected=success、actual=failure 报红。
- 收尾资源记录中 TP CN 为 Ready、restart=0,未见 OOMKilled;这只能排除容器当时已重启,不能替代报错时的内存剖面。同轮 DN 曾较早因另一问题重启([Bug]: WAL 消息超过 100 MiB 后 DN panic 重启,TP/AP 提交状态未知 #31350),目前没有证据证明与本错误有因果关系。
预期结果
该既有 100 并发 HNSW 查询负载应无非预期 SQL 错误,并产出有效性能与召回结果;如资源确实不足,需定位造成准入失败的内存归属、容量边界及是否存在回归。
对照与发生频率
- 当前已核实:2026-10-27 这一轮 1/1 失败;尚未在更新的 main 提交上复跑,也未定位首坏提交。
- 此前 6 个同参数周回归样本(10/18、10/19、10/20、10/21、10/23、10/25)均为 100 终端、5 分钟、0 SQL 错误。最近对照:10/25 run 40205399128 中 1,060,131 成功、0 错误;10/23 run 39975529250 中 1,062,161 成功、0 错误。
- 因有更早失败运行的日志已过期,只能称为近期同参数样本中首次确认,不能断言历史上绝对第一次。回归编排版本和 MO SHA 均有变化,不能仅由上述对照指定致因提交。
证据与初步分析
- HNSW 查询日志、summary、错误明细 artifact;集群资源与 Pod 状态 artifact。
- 错误路径对应 SQL MergeTop 的内存分配/准入失败(相关源码),不是已关闭 [Bug]: HNSW multi-index merge still materializes shard_count × LIMIT candidates #25637 所述的 HNSW 内部候选 heap。HashBuild 也在同阶段触及内存预算,提示需检查 TP CN 共享内存压力,但目前无法归因于 HNSW 本身、并发负载、缓存或其他作业。
- 检索现有 issue 后未发现与该 1M SIFT128 / 100 并发 / MergeTop+HashBuild 3015 组合完全一致的单;[Bug]: [main tke regression] Hnsw Index Gist960 Vector 1M Benchmark Test(L2_distance) oom. #24041、[Bug]: [date 3.18]main tke regression: hnsw index query mo oom #23904、[Bug]: TPCC 1000W/1000T memory pressure rejects 100922 transactions and new-session authentication with cap=0 #29753 为不同环境或症状,暂不直接合并。
建议排查与验收
- 保留此 1M SIFT128、100 终端、5 分钟回归场景,不通过跳过错误或降低并发使其“变绿”。
- 在报错时间窗对齐 TP CN 的 RSS、Go heap、mpool/SQL operator 账户、缓存占用、CDC/MOTR 共置情况和查询计划;分别做独立负载与 Family 并发对照。
- 在最新 main 上重复运行,确认稳定复现后比较好/坏 MO 提交及编排变化。验收以 SQL 错误数=0、有效 QPS/召回、无 OOM/异常重启为准。
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingseverity/s0Active / top priority for current sprint. Owner has committed to working on it now.
Activity
aunjgr commentedon Oct 27, 2026
Follow-up: memory pressure, workload overlap and attribution
The immediate failure is SQL execution-memory admission being rejected while HNSW, CDC and MOTR were active on the TP CN. The evidence points to substantial shared workload pressure and unusually high retained Go heap later in the run. It does not yet identify the owner of the memory, establish a leak or incorrect accounting, or identify a first-bad MatrixOne PR.
What changed in the observed workload
All times below are UTC. The vector runner and test-definition digest are identical in these two runs; the MatrixOne and MOTR revisions differ.
2f8011faecaa402801288ca4e34270d8bd404a926c1942f3cf0d4b967864dcc1d67b7884164a2fdbThe #27525 case first loads 500,257 rows in 503-row
INSERTbatches and then checksINTERSECT DISTINCT. Its script is byte-identical across the compared MOTR revisions. Its elapsed time grew from about 42 seconds to 322 seconds; the log does not separately time the load and first query. The first HNSW failure was reported at 20:48:54, during the #30017 case, but HNSW errors continued after that case ended. Neither coincidence establishes which case caused the pressure.MOTR #279 moved 29 account-lifecycle cases from the parallel lane to a later exclusive phase, changing when remaining cases can run. In the failing run the #27525 case began about 140 seconds after the parallel lane started, compared with 430 seconds in the previous run. However, the Family workflow already permitted MOTR/vector overlap before #279: the relative start also depends on AP completion and scheduling. This is a plausible exposure mechanism, not proof that #279 caused the memory failure.
Independent signs of pressure
The CDC job repeatedly checked initial convergence against a TPCC dataset of about 3.8 million order-line rows in both runs. In the failing run its sink advanced from 1,515,520 to 1,810,432 rows between 20:48:53 and 20:52:22, roughly 1,400 rows/s. From 20:52:22 to 20:54:24 it advanced to 2,764,323, roughly 7,800 rows/s, while IVF data was being loaded. HNSW and the long MOTR case ended together, so this comparison cannot attribute the recovery to either one. CDC did not converge before its 15-minute deadline; the previous run did. Failing CDC job, passing CDC job.
At final cleanup, several hours after the HNSW failure and after the workflow's workload jobs had ended, the failing TP CN's GC log reported 28,568 MB live heap after GC, versus 5,584 MB in the passing run. Its GC scan also reported about 77.6 million 64-byte-class objects, versus 3.4 million in the passing run. The runs had different prior workloads and outcomes; these late observations show a significant difference in retained state but do not prove what was live at 20:48 or identify its type. Failing Kubernetes evidence, passing Kubernetes evidence.
What the errors and PR history do—and do not—show
The 326 failures comprise 320 MergeTop capacity errors and six HashBuild memory-budget errors. One HashBuild error reports
requested=16384, used=26015002320, limit=26015007832. Those fields are admission-accounting values, not a measurement of this query's resident memory or the container's RSS. The same error format can represent query-cap, aggregate-CN-cap, or physical-headroom rejection; it does not identify the branch or allocation owner.The admission and affected operator sources are unchanged between the last passing and failing MO revisions. #29646 introduced the live-headroom mechanism, and #27112 / #26531 introduced relevant operator accounting, but all were already in the passing build. They describe the protection path, not a demonstrated first-bad change. #30629 landed between the two builds and changed TN append/logtail handling, making it a reasonable candidate for the concurrent write/CDC slowdown; no controlled comparison establishes it as the cause.
Next discriminating evidence
-profile-interval=30sand profile-scrape annotations. The GitHub artifacts contain only log tails, not the profiles, and the run namespace has been deleted. Compare allocation sites and retained objects before attributing the 64-byte class or declaring a leak.GOMEMLIMIT=25000MiBconfiguration, compare the good and failing MO revisions with a fixed workload schedule: HNSW alone, then with the MOTR and CDC workloads individually and together. Record execution-account usage, physical/cgroup and Go/native memory, query plans, errors, throughput and recovery after each workload ends.aunjgr commentedon Nov 2, 2026
Investigation update: confirmed logtail regressions and proposed fixes
An isolated parent-versus-merge comparison confirms that #30629 introduces substantial logtail CPU/work amplification. This does not yet prove that it caused the HNSW resource-admission failures tracked here. The next action is to fix the measured logtail regressions while preserving the concurrent-append correctness that #30629 introduced.
Confirmed component results
Compared the exact parent
28e8760905a7f39dba2ce436357ea75492f30512with mergeccfca4f7fdc75f1c8e6cb14730f4759dc6efce66. Tracked production sources were unchanged in both diagnostic worktrees. Both used matching native inputs and the same Go 1.27.1 SIMD/v3 configuration.For a history of 8,192 append nodes, the append-range collection probe produced:
These are component timings, not HNSW query timings. Measurement used six balanced before/after process pairs on the same local CPU; the first result for each case in each process was excluded. CPU profiles were collected separately and excluded from latency scoring. The 95% bootstrap interval for the one-row paired slowdown was 84.21–86.07×.
Execution counts and profiles identify the mechanism:
TxnMVCCNode.PreparedInchecks account for 70.8% flat CPU in the separate merge profile.A separate probe exercises the real
BoundTableOperatorandTableLogtailRespBuilderwith an instrumented object-data implementation. With 64 older objects whose append bounds are unknown and one in-range catalog creation, the parent makes 2 data-collection calls, while the merge makes 65. Both return the same single metadata command; both data and tombstone variants reproduce this. With known finalized bounds, the merge correctly reduces this to one call. This is caller-path evidence, not a loaded-database workload or a measurement of the original TKE object's population.The two critical files are byte-identical to the merge on the inspected main revision
be8eb40ad8bb7b35cbd3c1f50a5a6d23e1f6da1e:This source comparison does not substitute for a whole-query benchmark on current main.
Proposed PR 1: restore indexed timestamp-range collection
Keep physical row order and prepare timestamp order as separate access paths. Concurrent Freeze means those orders can differ; copying the old single-index implementation back would risk missing or misaligning rows.
AppendNode.PrepareCommitcopies it. Inspect outstanding preparations as well as indexed candidates, release locks before waiting, then redo the lookup after reacquiring the lock.The intended read cost is indexed lookup plus outstanding-preparation checks, sorting of matching nodes, and emitted-row work, rather than repeated scans of all historical nodes. Memory and write-side costs are part of acceptance.
Proposed PR 2: skip unnecessary older-object row collection
Build on PR 1's range lookup to cheaply determine whether an older object can contribute rows before invoking expensive collection.
This removes unnecessary row collection. It does not promise to eliminate every cheap metadata probe when object bounds remain unknown.
Validation and closure criteria
GOMEMLIMIT=25000MiB/ 100-client setup. Require zero unexpected SQL errors, valid QPS/recall, no OOM/restart, and capture CPU, admission usage, Go/native/cache memory and recovery after concurrent workloads end.The local results justify the two logtail fixes. They do not identify the original TKE memory owner or prove the incident's introducing commit. Also, the flush path where a busy tombstone can block ready data already existed in #30629's parent; that behavior must not be misattributed to this PR. No production patch or PR has been created for this design yet.
aunjgr commentedon Nov 2, 2026
Implementation update: one focused logtail PR
PR #32031 — open and ready for review, using the MatrixOne template.
The implementation addresses the confirmed append-range scanning regression. It keeps this HNSW incident open: the measurements below do not prove that the original SQL resource-admission failures are resolved.
Credit to Ariznawlll's Oct 29 report, which had already identified the full-history scans and requested the parent/merge comparison. Our controlled measurements confirmed and quantified that concern.
Final implementation
This is one PR. The earlier two-PR outline is superseded; a separate caller-side range pre-check would duplicate work.
Local controlled results
Separate baseline/candidate trees, normal Go 1.27.1 SIMD/v3 and matching native inputs; six balanced process pairs, first sample per case/process excluded. Initial warming is outside scored latency. Profiles and forced-GC memory measurements are separate. Scripts execute/drain without dataset, row, reference or checksum verification.
The concurrent unit's paired ratio is 0.321, 95% bootstrap interval [0.285, 0.375]. Standalone writer ratios at 64/1,024/8,192 nodes are 1.007/1.017/1.013, with intervals [0.987,1.026]/[0.995,1.027]/[0.989,1.040]: those small differences remain inconclusive. No confirmed regression remains in the scored warm read/writer/caller controls; this is not proof of universal zero regression.
The table-operator fixture executes the real response builder and MVCC collector through a payload-free object-data seam. It measures no-change older-object work, not a loaded database. The concurrent control overlaps actual MVCC writes and collection, not SQL clients or the full Family schedule.
Cost and profiling
Indexed live Go state rises from 168.1 to 227.4 B/node in the 8,192-node storage fixture: approximately 59.3 B/node / 0.46 MiB per object additional metadata. Its references/capacity are included in the existing memory estimate and released on deactivation/history release. Row payloads are not copied into the index. Initial construction is synchronous reader-owned work under the object write lock and is excluded from the warm-latency table.
Separate CPU captures attribute 76.8% of baseline one-row collection CPU to repeated
PreparedInchecks. The candidate removes that full-history work; remaining CPU is in indexed lookup, vector allocation/output and runtime bookkeeping. The committed benchmarks allow others to reproduce the measurements.Validation and remaining incident work
Normal owning-package tests, owning race checks, 100-run exact-cutoff reader stress, 100-run prepare-window stress, the concurrent benchmark's race check, and existing replay/flush/GC engine consumers pass. Focused index-module statement coverage was about 92% before the final lint-only cleanup and additional queued-removal assertions. The full repository standard pre-push static gate passed at
e1568b6bc0. Mergify then merged newer main commits; all seven PR files remain byte-identical. Latest-head CI is running; it is not counted as a pass.For #31374 closure, still compare the original 55 GiB CN / 16 GiB cache / GOMEMLIMIT=25000MiB / 100-client HNSW load under a fixed CDC/MOTR schedule. Require zero unexpected SQL errors, valid QPS/recall and no OOM/restart, with admission, Go/native/cache memory and post-workload recovery captured. No first-bad attribution for the original HNSW incident is claimed from these component results alone.
perf(tae): index logtail append ranges on demand (#32031)
XuPeng-SH commentedon Nov 2, 2026
合并进展与范围确认
PR #32031 已于 2026-11-02 13:09:05 UTC 合入
main,merge SHA 为035356d963f6dd124a61d66d0018aa0b8da3247f。此前“open / CI running”的进展已更新:本轮远端核对最终 PR headbb899f79f50e678930a07dbd0f0da9f0325b6560的 CI Required、UT、SCA、共享构建及已启用 COMPOSE / PROXY BVT 均为 success;跳过的升级等检查不计作通过。本次只覆盖已量化的 append-range 扫描退化,不代表本 issue 的 HNSW / CDC / MOTR 联合负载资源准入事故已修复。保留 aunjgr 和 open 状态,不将此总项改派 QA;之前两 PR 方案已被单个 #32031 实现替代,不把旧方案当作未完成开发项。剩余事故范围及原配置联合负载验证要求以此前实现更新为准。
以上是远端状态、PR 范围与作者/评审证据核对,本轮未运行本地产品测试,也不声明验收通过。
aunjgr commentedon Nov 3, 2026
Post-merge HNSW evidence and exact remaining acceptance
The confirmed append-range scanning fix is complete: #32031 merged as
035356d963f6dd124a61d66d0018aa0b8da3247f. No second caller-side optimization PR remains from the superseded two-PR outline.I audited the Nov 2 full Family run, including its image receipt, HNSW report, CDC timeline, routing/resource manifest and pod health records. This provides new post-merge workload evidence, without launching another benchmark.
035356d963f6dd124a61d66d0018aa0b8da3247f, exactly the #32031 mergeGOMEMLIMIT=25000MiB,GOGC=200GOMEMLIMIT=20000MiB,GOGC=200The HNSW job and CDC job succeeded. The overall Family run failed other gates; this is not an overall CI pass. The vector comparison explicitly says
BASELINE_BUILDINGandperformance_verified=false. Its report does not establish exclusion of a cold run, so the QPS above is a recorded workload result, not an accepted warm performance comparison or a claimed HNSW speedup.This is encouraging recovery evidence, but it does not meet the previously agreed incident closure criteria. MOTR now ran at 22:41–23:29 UTC, after HNSW, and its pinned revision/schedule changed. There is no matched baseline/candidate pair or query-window memory/profile evidence here. Therefore neither attribution of the original admission errors to #30629 nor their resolution specifically by #32031 is established.
Remaining work
Both frozen images and the original-client/CDC preparation succeeded. The diagnostic workflow is prepared; no paired TKE workload has run.
The current blocker is a usable existing Family connection, not permission to use it. The authorized checked-in
kubeconfig/tke-configidentifiescls-9nd9no1l; the actual Family target iscls-rzk3m6se. Standard diagnostic runners have no default kubeconfig, andmo-auto-testhas noTKE_KUBECONFIG_B64input configured. My current GitHub account has read-only access tomo-nightly-regression, so it cannot dispatch that repository's credential-bearing workflow. Supplying the correct existing connection throughTKE_KUBECONFIG_B64inmo-auto-test, or its existing configuration location, unblocks the prepared validation. Credential values should not be posted to this issue.The issue remains open for this explicit acceptance gap; the component implementation is finished.
aunjgr commentedon Nov 3, 2026
Recent-nightly comparison: symptom recovered; fixing change unconfirmed
The four most recent completed HNSW jobs all report zero SQL errors. Recovery was already visible before #32031 merged. The latest result therefore does not establish that #32031 fixed the original admission incident.
Dates below use the actual query window in UTC, not issue creation time or campaign dispatch time. QPS and latency are the reports' own values; these are observational Family results, not a controlled warm benchmark.
6c1942f3cf-1)8f9bcd29edee8b20692e-1)c8534cc3e21565fb79abc5c163cd23035356d963All four recent reports retain 100 terminals and approximately five minutes of queries. Their resource evidence retains 1 TP + 2 AP, CN 55 GiB / cache 16 GiB /
GOMEMLIMIT=25000MiB, and the resource-health records show no CN restarts or OOM termination.Important exposure differences:
The latest QPS is only about 0.12% above Oct 31 evening (4,130 vs 4,125); RT99 is 80.31 vs 79.08 ms. There is no meaningful observational HNSW speedup to attribute to #32031 here. The confirmed local append-range improvement and HNSW incident attribution remain separate claims.
Conclusion: the reported admission failures are no longer reproducing in the four most recent completed nightly HNSW jobs. That is stronger recovery evidence than the single Nov 2 run previously summarized. It is still insufficient to identify the fixing change or prove the original pressure condition eliminated: an earlier Oct 28 pass was followed by the Oct 29 recurrence, and cohost schedules differ. #31723 is present in the inspected Oct 31 passing SHAs and absent from the Oct 29 failing SHA; this is a temporal candidate, not causal proof.
No additional product-code change is justified by these reports alone. The issue remains open for the previously described incident acceptance/attribution gap; this comparison launches no benchmark or CI rerun.
aunjgr commentedon Nov 3, 2026
Downgraded from
severity/s-1toseverity/s0and reassigned to the original reporter, Ariznawlll, for verification, as requested.The four most recent completed HNSW nightly jobs report zero SQL errors at the original 100-client concurrency and memory budgets. The last confirmed recurrence was Oct 29. Recovery predates #32031, and concurrent-workload exposure varies, so this is not a confirmed attribution of the incident fix. The issue remains open for reporter verification.
Recent-nightly comparison and evidence.
Ariznawlll commentedon Nov 3, 2026
结论
补充回归核查:目前相关 HNSW 用例已连续恢复,最近四次已完成的 nightly HNSW 测试均未再出现本 issue 的 SQL 内存准入错误。但原 HNSW / CDC / MOTR 联合压力条件下的修复验收尚未完成,本次不据此关闭 issue,也不把缺少该项验证描述成当前测试失败。
关键证据
Vector / HNSW SIFT128 / L2步骤成功。实际 MO 为main@035356d963f6dd124a61d66d0018aa0b8da3247f,即 perf(tae): index logtail append ranges on demand #32031 的合并提交。TERMINALS=100、SUCCESS=1271566、ERROR=0、RESULT=SUCCEED;报告 QPS 4130、召回率 92.06%、RT99 80.31 ms。该结果是实际用例完成,不是因整轮状态或跳过步骤推断通过;QPS 不作为受控性能提升结论。GOMEMLIMIT=25000MiB,HNSW 查询期间有实际 TPCC CDC 复制,资源检查未记录重启/OOM;但 MOTR 在 HNSW 结束后才执行,未覆盖原来三者同时运行的压力组合。待解决点
需要在原资源预算及固定的 HNSW + 写入 + CDC/MOTR 并发时序下补齐验证,确认 SQL 错误为 0、召回有效、无 OOM/异常重启,并保留查询窗口的内存准入、Go/native/cache 占用及负载结束后的恢复证据。当前已有的连续恢复结果应保留,但不替代这项尚未完成的验收。
本次仅核查现有日志和研发记录,未触发新测试,未修改 issue 状态。
Ariznawlll commentedon Nov 4, 2026
结论
测试通过。本次结论限定为当前 main nightly 中本 issue 对应的 HNSW SIFT128 查询场景:近期连续完成的相关测试未再出现 MergeTop / HashBuild 内存准入错误。按报告人本次要求,以当前 main 回归持续未复现作为关闭依据,关闭本 issue;不将关闭解释为某个 PR 的因果验证,也不代表整轮回归全部通过。
关键证据
main@54a6b173282c1df71fcbf54fff42869a27cf4fc5,已核对镜像构建凭据,不是将测试仓库 SHA 当作 MO SHA。M=8 / EF_CONSTRUCTION=200 / EF_SEARCH=64 / vector_l2_ops;100 终端、5 分钟。北京时间 2026-11-04 04:43:27–04:48:26,成功 1,136,558 次,ERROR=0、RESULT=SUCCEED,召回率 92.11%,RT50 22.87 ms、RT99 84.31 ms;原始错误文件为 0 字节。原始日志与报告-1,Family 报告保留原值,并用成功数 / 起止时间差得到有效 QPS 3801.20(1,136,558 / 299 秒)。SQL 成功数、错误数、召回率及运行窗口均有原始证据;这里不把该派生 QPS 当作受控性能改善结论。GOMEMLIMIT=25000MiB、GOGC=200;资源健康记录显示 9 个预期 Pod 身份一致,全部 restart=0,无记录到的 OOM termination。本次还重新下载核对了下列四轮的镜像凭据和 HNSW 原始报告,均为 100 终端、约 5 分钟,未跳过相关用例:
1565fb79abc5c163cd23035356d96354a6b17328其中 41319347616 整轮后来取消,但 HNSW 已完成,不将它算成整轮通过。结合研发此前已核实的 41077521007 attempt 2,最近五个已完成 HNSW 样本均为 0 SQL 错误;最后确认复现仍是 UTC 10 月 29 日的 40898244248。
待解决点