Skip to content

[Bug]: [main tke regression] sysbench 1000w insert ignore oom. #24307

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

dc98e3d

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

job: https://github.com/matrixorigin/mo-nightly-regression/actions/runs/25504956103/job/74893778528

log: https://grafana.ci.matrixorigin.cn/explore?panes=%7B%22wsa%22:%7B%22datasource%22:%22loki%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22expr%22:%22%7Bnamespace%3D%5C%22mo-main-commit-dc98e3d3a-20260507%5C%22%7D%20%7C%3D%20%60%60%22,%22queryType%22:%22range%22,%22datasource%22:%7B%22type%22:%22loki%22,%22uid%22:%22loki%22%7D,%22editorMode%22:%22builder%22%7D%5D,%22range%22:%7B%22from%22:%221778190028000%22,%22to%22:%221778190568000%22%7D%7D%7D&schemaVersion=1&orgId=1

mem:https://grafana.ci.matrixorigin.cn/explore?panes=%7B%22wsa%22:%7B%22datasource%22:%22pyroscope%22,%22queries%22:%5B%7B%22groupBy%22:%5B%5D,%22labelSelector%22:%22%7Bnamespace%3D%5C%22mo-main-commit-dc98e3d3a-20260507%5C%22%7D%22,%22queryType%22:%22both%22,%22refId%22:%22A%22,%22profileTypeId%22:%22memory:inuse_space:bytes:space:bytes%22,%22datasource%22:%7B%22type%22:%22grafana-pyroscope-datasource%22,%22uid%22:%22pyroscope%22%7D%7D%5D,%22range%22:%7B%22from%22:%221778190028000%22,%22to%22:%221778190568000%22%7D%7D%7D&schemaVersion=1&orgId=1

Image

Expected Behavior

No response

Steps to Reproduce

trigger tke regression.

Additional information

No response

Activity

  1. added this to the MO-202605 milestone on May 8, 2026
  2. added theissue type on May 8, 2026
  3. added
    kind/bug
    severity/s0
    on May 8, 2026
  4. Ariznawlll commented on May 8, 2026

    @Ariznawlll
    CollaboratorAuthor
    Image
  5. Ariznawlll commented on May 8, 2026

    @Ariznawlll
    CollaboratorAuthor

    1000w insert ignore 100 并发压力下,CN sqvxb 的 logtail 消费积压触发 objectio 元数据和 bloom filter 的大量重读/重载,mpool 反复 realloc 进入无节制扩张,突破 55GB limit 被 cgroup OOMKill。 可拆成三层:

    1. logtail consumer 先拉胯(21:40:53 → 21:43:28 持续 2.5 分钟 ⁠signal-chan-len⁠ 7000+,消费落后于生产),这是导火索 —— 让 sqvxb 的 PartitionState 无法及时推进, ⁠HandleRowsInsert⁠ / btree copy 吃 Go heap(4.2%+3.4%),同时触发 CN 反复 ⁠LoadObjectMetaByExtent⁠ 、 ⁠ReadBloomFilter⁠ (合计 34.5% Go heap self)
    2. objectio 冷读放大 mpool 分配:bloom filter 和 object meta 的 vector 通过 ⁠NewVecFromReuse⁠ 走 mpool 路径, ⁠MPool.reAllocWithDetailK⁠ 吃下 46.1% mpool self(绝对量 175GB 累积分配),这就是本次 OOM 的直接原因
    3. sysbench 100 并发 insert 在仅 ~5s 内压来,放大了 (1) 和 (2),sqvxb 顶死 working_set 50GB / limit 55GB 四分钟后被 SIGKILL
      和 issue 标题"oom"匹配。不是 Go heap 泄漏,是 mpool 高峰 × logtail 消费卡住共同效应。
      Pitfalls 核对
      ⦁本次 ⁠last_terminated_reason=OOMKilled⁠ (cgroup 杀),不是 Go runtime ⁠fatal error⁠ ,所以 Loki 搜 ⁠fatal error: out of memory⁠ 是 0 命中(正常)
      ⦁malloc peak 是 self 累积值(25GB nonzero peak + flame self 380GB 分布),不等于瞬时 mpool 驻留;但 ⁠reAllocWithDetailK⁠ 46% 占比表明反复 realloc,是典型的 mpool 扩张病理
      建议排查方向
    4. logtail consumer 慢消费是否新问题:grep main 分支近期是否改动 ⁠disttae/logtail_consumer.go⁠ 的批处理窗口(源头在 ⁠routine-id:0⁠ ,单线程消费扩散不下去)
    5. objectio bloom filter / metadata 的 mpool 路径:确认 ⁠vector.NewVecFromReuse⁠ 有没有 oversized pool 命中 ⁠reAllocWithDetailK⁠ —— 也可能是 ⁠fix(malloc): harden pprof output for Pyroscope malloc profiles #24197⁠ malloc 硬化合入后暴露的历史分配模式
    6. 短期规避:sysbench 1000w prepare 的并发从 100 降到 50,或把 CN memory limit 从 55GB 提到 60GB,用历史 nightly 跨日对比验证是不是退化(Mode 2 跨日)— 要做我继续
  6. VioletQwQ-0 commented on May 8, 2026

    @VioletQwQ-0
    Collaborator

    Triage summary

    Run 25504956103, job SYSBENCH OLTP TEST 1000W (id 74893778528) failed with exit code 1, but the direct cause is one CN pod getting OOMKilled by cgroup, not a sysbench assertion.

    OOM pod and timing

    • Namespace: mo-main-commit-dc98e3d3a-20260507
    • Pod: nightly-regression-dis-tp-cn-sqvxb (CN, TP CNSet)
    • kube_pod_container_status_last_terminated_reason = OOMKilled, restart count = 1
    • Memory limit = 55 GB, working_set peak = 50.04 GB (91%), held at this level for ~4 min then SIGKILLed around 21:43:52Z
    • Timeline:
      • 21:40:53Z — logtail.consumer.slow.send.table.log.tail / slow.update.time with signal-chan-len growing past 7000 within seconds (200 hits clustered in a short burst)
      • 21:43:22Z — sysbench starts 100-thread insert ignore into sbtest1..10
      • 21:43:28Z — sysbench runner begins reporting Communications link failure (5s read timeout)
      • 21:43:52Z — connection reset by peer → sqvxb terminated; new container starts at 1.5 GB working_set
      • 21:48:38Z — sysbench runner aggregates RESULT: FAILED, exit 1

    Profile evidence at OOM (service_name="$NS/main", pod=sqvxb, ±2min)

    memory:inuse_space (Go heap) — top self-bytes:

    self % function
    19.3 GB 19.2% objectio.ReadBloomFilter
    17.5 GB 17.5% container/vector.NewVecFromReuse
    15.4 GB 15.3% objectio.LoadObjectMetaByExtent
    5.96 GB 5.9% io.ReadAll
    4.23 GB 4.2% disttae/logtailreplay.(*PartitionState).HandleRowsInsert
    3.88 GB 3.9% pb/api.(*Vector).Unmarshal
    3.45 GB 3.4% tidwall/btree.(*BTreeG).copy

    malloc:inuse_space (mpool off-heap) — overwhelmingly concentrated in two paths:

    self % function
    175.6 GB 46.1% mpool.(*MPool).reAllocWithDetailK
    170.2 GB 44.7% malloc.(*MetricsAllocator).Allocate

    Cross-pod comparison (same window, same profile type):

    pod memory peak malloc peak
    sqvxb (OOM) 5.58 GB 23.58 GB
    tp-cn-456bp 6.88 GB 17.40 GB
    tp-cn-rzv2z 4.75 GB 15.32 GB
    dn-0 8.64 GB 7.07 GB

    Only sqvxb's mpool peak exceeds the other CNs by 35-55%; Go heap is not the differentiator.

    Regression onset — not a new flake

    Counted two Loki signals across the last 8 Main Nightly runs in the same nightly window (logtail.consumer.slow and MergeExecutorEvent-PauseDueToOOMAlert):

    date matrixone HEAD sysbench 1000W logtail.slow PauseOOMAlert
    4/30 6a03940e2 SUCCESS 0 0
    5/1 d67ff7ca4 failure 0 0
    5/2 7985f0213 failure 0 0
    5/3 9e1f4059e SUCCESS 0 0
    5/4 5942ae875 failure 2420 7885
    5/5 502bba205 failure 5742 7201
    5/6 b1e35e017 failure 6326 6927
    5/7 (this issue) dc98e3d3a failure 5782 6881

    Both signals were identically zero through 5/3 and jumped to thousands on 5/4, then stayed elevated. The regression window narrows to 9e1f4059e..5942ae875 on main — only 2 commits:

    Verified 5/3 SUCCESS run actually built HEAD 9e1f4059e and 5/4 failure run built 5942ae875 via each run's BUILD job git log -1 --format='%H' line.

    Prime suspect: #24268

    PR #24268 adds per-batch CNMemoryThrottler.Acquire in insert.ToWriteS3 with a retry path through flushS3WriterOnMemoryPressure when memory is denied. The retry path calls SyncAndFillBlockInfoBat + Append, which is exactly the chain that allocates through vector.NewVecFromReuse → objectio.LoadObjectMetaByExtent / ReadBloomFilter — matching the top of sqvxb's flame graph (34.5% Go heap + 46.1% mpool reAllocWithDetailK).

    Under 100-concurrent insert ignore, many workers hit throttler denial simultaneously, each triggering the sync-flush-and-retry cycle; this amplifies mpool realloc churn and explains the reAllocWithDetailK concentration observed here.

    PauseDueToOOMAlert itself predates the regression (introduced by #23532 on 4/17 in pkg/vm/engine/tae/db/merge/scheduler.go), but its trigger rc.Available() < 500MB is only reached when CN RSS stays high — which #24268's new reservation path is doing here.

    Secondary suspect: #24260

    Modifies aggregation kernels (sum_decimal_fast.go, count2.go, sumavg2.go) plus the shared pkg/container/vector/tools.go. The sysbench insert ignore path does not use aggregation, but the vector/tools.go change affects MustFixedColAsSlice semantics which could indirectly change allocator behavior in the same flame chain. Lower probability.

    Not suspected (b1e35e0..502bba2 range)

    The 4 commits between 502bba205 and b1e35e017 do not fit:

    And the regression was already present on 502bba205 (5/5 run: logtail.slow=5742, PauseOOMAlert=7201), so first-introduction is outside this window.

    Suggested verification

    1. Run sysbench 1000W on 9e1f4059e (last SUCCESS HEAD) directly — should show logtail.slow / PauseOOMAlert both at 0. Establishes a clean baseline.
    2. Cherry-pick revert of fix: throttle CN S3 writes under memory pressure #24268 on top of a recent HEAD and run sysbench 1000W — if the two signals return to 0 and OOM goes away, fix: throttle CN S3 writes under memory pressure #24268 is confirmed. This is the decisive test.
    3. If fix: throttle CN S3 writes under memory pressure #24268 revert is not sufficient, revert perf(agg): local accumulator with deferred scatter for BatchFill/BatchMerge #24260 as well.
  7. jiangxinmeng1 commented on May 11, 2026

    @jiangxinmeng1
    Contributor

    fixed by #24309

  8. Ariznawlll commented on May 11, 2026

    @Ariznawlll
    CollaboratorAuthor

    修复了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions