Skip to content

[Bug]: Object writer serialization buffers can remain unbounded in arena pool #29384

Closed

Description

@XuPeng-SH

Is there an existing issue for the same bug?

  • I have checked the existing issues (searched for serialBuf WriteArena and arena memory object writer).

Branch Name

4.2-dev (source code inspected; exact branch of the running DN has not been verified)

Commit ID

5c79c3b (local source checkout; running binary build ID: 218cecaaacdbffcc7240c7df4c52dc59ba530924)

Other Environment Information

  • MatrixOne DN in the IDC mo-new-moi environment, 2026-09-26 08:19 CST.
  • DN Go heap inuse_space profile: 6,491.17 MiB total.
  • The profile itself is not attached because it may contain deployment information; relevant aggregate output is quoted below.

Actual Behavior

An in-use DN heap profile attributes 1,293.22 MiB (19.92% of sampled in-use heap) to objectio.(*objectWriterV1).addBlock -> bytes.(*Buffer).Grow. The bytes.growSlice flat total is 1,324.23 MiB; the remaining ~31 MiB may have other callers.

The writer serializes each column into WriteArena.serialBuf when an arena is present. bytes.Buffer.Reset() clears the length but retains capacity. WriteArena.Reset() does not shrink serialBuf, and PutArena() can retain the arena in a free list. The pool limits the number of arenas, but does not limit their aggregate serialBuf capacity. Thus a large serialized column may leave a large Go-heap backing array retained across later write cycles, including idle periods while the pool remains warm. This is separate from the off-heap WriteArena.data and compressBuf allocations.

The profile identifies the allocation path; it does not show how much of the 1,293 MiB is currently in active writers versus pooled arenas. It also does not establish that these buffers alone caused the observed DN RSS pressure or merge throttling.

Expected Behavior

Reusable serialization buffers should have a bounded retained capacity or be released when disproportionate to normal write sizes. Pool memory should be observable so active and idle retention can be distinguished.

Steps to Reproduce

  1. On a non-production DN, run a write/flush/merge workload containing sufficiently large column vectors so objectWriterV1.addBlock grows serialBuf substantially.
  2. Let the corresponding writers return their arenas to the pool; keep normal checkpoint activity running so the 10-minute arena-drain timer continues to be reset.
  3. Capture Go heap inuse_space, force GC if appropriate for the experiment, and inspect bytes.(*Buffer).Grow / objectWriterV1.addBlock allocations and retained heap. Compare before and after a pool drain.
  4. Record pool size and serialBuf.Cap() for active and pooled arenas to confirm retention and quantify its contribution. These steps are a proposed controlled reproduction; they have not yet been run end to end.

Additional information

Relevant code:

  • pkg/objectio/writer.go: WriteArena.serialBuf; objectWriterV1.addBlock calls sbuf.Reset() and sbuf.Grow(vec.Size()+64); WriteArena.Reset() and FreeBuffers() do not explicitly reset the serialization buffer.
  • pkg/objectio/arena_pool.go: PutArena() retains arenas up to count limits (GOMAXPROCS/2 small and 2*GOMAXPROCS large); ScheduleArenaDrain() delays draining for 10 minutes after the last scheduling call.

Profile excerpt (go tool pprof -peek=addBlock, 2026-09-26 08:19:02 CST):

File: mo-service
Type: inuse_space
Total: 6491.17MB
objectio.(*objectWriterV1).AddBlock -> objectio.(*objectWriterV1).addBlock  1293.22MB
objectio.(*objectWriterV1).addBlock -> bytes.(*Buffer).Grow                 1293.22MB

Suggested investigation: measure pooled serialBuf.Cap() distribution and peak concurrent active arenas, then evaluate a maximum retained capacity or dropping oversized buffers on PutArena() while preserving write-path reuse for normal-sized vectors.

Activity

  1. added
    kind/bug
    on Sep 26, 2026
  2. added a commit that references this issue on Sep 28, 2026
    5648ebc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions