Skip to content

Release merge spill buffers on panic - #32160

Merged
XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/486cf6fd32386290aceac1cc4dbf516fbd8740aee75da7748563ea758ccabce9
Nov 29, 2026
Merged

XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
iamlinjunhong:codex/loom/develop/486cf6fd32386290aceac1cc4dbf516fbd8740aee75da7748563ea758ccabce9

Conversation

@iamlinjunhong

@iamlinjunhong iamlinjunhong commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

What this PR does / why we need it:

A merge spill can leave its current output buffer owned by nobody when a sink or buffer allocation panics, retaining memory after the sinker closes. Track ownership through the streaming, accumulate, and pipeline paths so that errors and panics return each buffer exactly once while preserving the original error or panic.

Validation on the reviewed commit:

  • The ioutil package passed normally and under the race detector, including on/off-heap, partial/full-block, error and panic cases.
  • Producer/worker handoff, reset, and replacement-fetch panic tests each passed 100 race runs; merge sort tests passed.
  • go vet, incremental golangci-lint, gofmt, and diff checks passed on the reviewed commit.
  • Ubuntu/x86 UT passed on e72ca7101584. The Coverage jobs stopped after HTTP 403 responses from the worker metadata API in run 46104447855.
  • Rebased onto main e75a4d2ca470 with the same three-file patch. On e6ca0ccd1810, mo-cgo-test -short -race -tags matrixone_test -p 1 -count=1 ./pkg/objectio/ioutil ./pkg/objectio/mergeutil passed on Darwin/arm64. Formatting and PR artifact checks passed. Linux/x64 and Coverage on this revision are pending CI.

The change adds fixed-cost cleanup and ownership bookkeeping without changing the merge algorithm or batch sizes. It does not claim to reproduce a deployed OOM or an actual oversized allocation; asynchronous worker panics retain their existing behavior.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@XuPeng-SH

XuPeng-SH commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: a0b98b53e872b61c947ef65fd2824de13b93b912

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: a0b98b53e872b61c947ef65fd2824de13b93b912

Assessment: approve

The merge spill fix keeps one owner for every current, accumulated, or queued batch and releases locally owned buffers during synchronous panic unwinding. It reuses the existing freelist and pipeline ownership rules without adding a lifecycle mechanism. The complete delta, linked issue, discussion, source consumers, and regression oracles are closed with no actionable findings.

Model: gpt-6.1-sol / max

Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0

Validation:

  • Reviewed all three changed files, MergeSortBatches overlap/disjoint paths, freelist, SinkPool submission/cleanup, writer arena, reset and Close; reconciled both discussion keys and linked issue #32156.

  • Normal and race short suites with matrixone_test tags passed: 75 ioutil and 14 mergeutil root tests per run, including all nine changed/new roots. Commands, frozen-source fingerprints, exits and log hashes are matched in validation-audit.json.

  • Three exact race roots passed 100 repetitions each: TestMergeSpillResetKeepsNewData, TestPipelineProducerPanicAfterWorkerTakesBatch, and TestMergeSpillReplacementOwnedOnPanic; counts derive from the measured race durations.

  • An owner-only merge-base overlay failed all four streaming panic cases with 98,304 retained bytes while its eight success/error cases passed; the current owner passes all twelve cases. This is an expected negative control, not a candidate failure.

  • Local go vet, formatting and diff whitespace checks passed. Private-runtime preflight and fresh source-pinned native prerequisites passed; retained setup failures were recovered before completed test runs.

  • Supplied exact-head CI reports successful UT, static analysis, coverage, shared build and multi-CN BVT checks; skipped and neutral checks were not counted as passes.

Limitations:

  • Validation establishes component ownership and synchronous panic cleanup; no real oversized-allocation or deployed OOM reproduction was attempted.

  • Asynchronous worker panic recovery is unchanged and outside this fix's claimed behavior. Broader CI conclusions use the supplied snapshot rather than independently downloaded CI logs.

@mergify mergify Bot added the queued label Nov 4, 2026
@mergify

mergify Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

❌ Left the queue · checks failed

2 h 32 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Wed 4 Nov, 11:12 · rule main · triggered by rule Automatic queue on approval for main
  • ❌ Checks failed · in place
  • 🚫 Left the queue 13:43 · ce0f995

The failure is in this pull request. It failed tested alone on top of main.

Reason

The merge conditions cannot be satisfied due to failing checks

  • CI Required

To get back in the queue

  • Push a fix: the pull request is queued again once its queue conditions match.
  • If the failure is a flake, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

Requeue requested — the merge queue status continues in this comment ↓.

2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

iamlinjunhong and others added 4 commits November 30, 2026 00:22
Cover errors and panics in the trailing merge batch for overlapping and
disjoint key ranges. Use typed batch allocation and the matching freelist
interface for the spill ownership regressions.

Co-authored-by: XuPeng-SH <[email protected]>
Signed-off-by: XuPeng-SH <[email protected]>
@mergify

mergify Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue · pull request dequeued

39 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Sun 29 Nov, 18:18 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 18:57 · 9d08bb2

Reason

Pull request #32160 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

To get back in the queue

  • Push a change if one is needed: the pull request is queued again once its queue conditions match.
  • If no change is needed, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request
2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

This branch was successfully deployed

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

Labels

dequeued kind/bug Something isn't working size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants