Skip to content

test(fileservice): release memory cache test data - #27426

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-27305-f44d3a06
Aug 21, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
gouhongshen:agent/issue-27305-f44d3a06

Conversation

@gouhongshen

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:

Related to #27305

What this PR does / why we need it:

Root cause

TestMemoryCachePressureAdmissionAdmitsGhostEntry created foreign staticTestData vectors and called MemCache.Update. Admission rehomes foreign data into allocator-backed cache data and rewrites the vector entry, so the vector remains the caller-owned reference that must be released. The loop omitted that release.

The same test then called DataCache.Get to assert cache and ghost membership. A successful Get retains the returned data through the cache post-get callback. The test discarded each successful value, leaving extra checked-allocator references alive. The later coverage test allocator finalizer reported the leak as missing free.

Changes

  • Release each vector immediately after its update in the admission loop.
  • Add a local cache-membership helper that releases every retained value returned by a successful Get, and use it for all membership assertions in the test.
  • Keep the production cache ownership contract and ghost-entry assertions unchanged; this PR only corrects test-owned references.

Issue-to-test proof

  • [Bug]: fileservice MinIO coverage test panics with missing free #27305: The existing TestMemoryCachePressureAdmissionAdmitsGhostEntry covers pressure admission, eviction, ghost replacement, and hit/miss membership. The test now closes both ownership edges that triggered the checked allocator report.
  • Before the change, an isolated forced-GC reproduction of the same vector admission path terminated with CheckedAllocator: missing free; after the change, the target test passes with allocator checking and aggressive GC.

Verification

  • MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s -run '^TestMemoryCachePressureAdmissionAdmitsGhostEntry$' ./pkg/fileservice
  • MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -v -cover -count=1 -timeout=120s -run '^(TestMemoryCachePressureAdmissionAdmitsGhostEntry|TestObjectStorages)$' ./pkg/fileservice
  • MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=240s -skip '^TestMinioSDK$' ./pkg/fileservice
  • GOWORK=off go build -mod=readonly ./pkg/fileservice
  • GOWORK=off go vet -mod=readonly ./pkg/fileservice
  • gofmt -d pkg/fileservice/mem_cache_test.go
  • git diff --check

Residual risk / environment note

The local unfiltered package run remains unable to complete because the locally started MinIO instance reports XMinioStorageFull and Access Denied in TestMinioSDK; this is an environment failure unrelated to this test-only diff. No QCloud credentials are configured locally, so the external qcloud/minio branch of TestObjectStorages remains for CI validation. No production code, API, or concurrency behavior changes.

@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 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.

Reviewed exact head 4ea564849d1c.

Both missing ownership edges are closed correctly: MemCache.Update rehomes foreign data and rewrites the caller-owned IOVector entry, so releasing the vector drops that reference; a successful DataCache.Get retains through the post-get callback, so each membership probe must release its returned value. Cache ownership and eviction semantics remain unchanged.

Validation passed with the checked allocator and aggressive GC (five focused repetitions plus the coverage-trigger path), as well as fileservice build-only testing and go vet.

@mergify mergify Bot added the queued label Aug 21, 2026
@mergify

mergify Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-08-21 08:41 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-08-21 11:30 UTC · at d511962294df93e3593d2ec9e575812b032eb9d2

This pull request spent 2 hours 48 minutes 40 seconds in the queue, with no time running CI.

Waiting for
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of: [🛡 GitHub branch protection]
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
All conditions
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / UT Test on Ubuntu/x86
    • check-skipped = Matrixone CI / UT Test on Ubuntu/x86
    • check-success = Matrixone CI / UT Test on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone CI / SCA Test on Linux/arm64
    • check-skipped = Matrixone CI / SCA Test on Linux/arm64
    • check-success = Matrixone CI / SCA Test on Linux/arm64
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-skipped = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
    • check-success = Matrixone Compose CI / multi cn e2e bvt test docker compose(PROXY)
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Utils CI / Coverage
    • check-skipped = Matrixone Utils CI / Coverage
    • check-success = Matrixone Utils CI / Coverage
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-skipped = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
    • check-success = Matrixone UT Coverage / UT Coverage on Ubuntu/x86
  • any of [🛡 GitHub branch protection]:
    • check-neutral = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-skipped = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
    • check-success = Matrixone Standlone CI / multi CN e2e BVT Test on Linux/x64(COMPOSE, PESSIMISTIC)
  • #review-threads-unresolved = 0 [🛡 GitHub branch protection]
  • github-review-approved [🛡 GitHub branch protection]

Reason

Pull request #27426 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.

Failing checks:

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

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

  • Requeue this pull request

@XuPeng-SH
XuPeng-SH merged commit 1d867a6 into matrixorigin:main Aug 21, 2026
19 of 20 checks passed
@mergify mergify Bot added dequeued and removed queued labels Aug 21, 2026
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to matrixorigin#27305

## What this PR does / why we need it:

### Root cause

`TestMemoryCachePressureAdmissionAdmitsGhostEntry` created foreign
`staticTestData` vectors and called `MemCache.Update`. Admission rehomes
foreign data into allocator-backed cache data and rewrites the vector
entry, so the vector remains the caller-owned reference that must be
released. The loop omitted that release.

The same test then called `DataCache.Get` to assert cache and ghost
membership. A successful `Get` retains the returned data through the
cache post-get callback. The test discarded each successful value,
leaving extra checked-allocator references alive. The later coverage
test allocator finalizer reported the leak as `missing free`.

### Changes

- Release each vector immediately after its update in the admission
loop.
- Add a local cache-membership helper that releases every retained value
returned by a successful `Get`, and use it for all membership assertions
in the test.
- Keep the production cache ownership contract and ghost-entry
assertions unchanged; this PR only corrects test-owned references.

### Issue-to-test proof

- matrixorigin#27305: The existing
`TestMemoryCachePressureAdmissionAdmitsGhostEntry` covers pressure
admission, eviction, ghost replacement, and hit/miss membership. The
test now closes both ownership edges that triggered the checked
allocator report.
- Before the change, an isolated forced-GC reproduction of the same
vector admission path terminated with `CheckedAllocator: missing free`;
after the change, the target test passes with allocator checking and
aggressive GC.

### Verification

- `MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s -run
'^TestMemoryCachePressureAdmissionAdmitsGhostEntry$' ./pkg/fileservice`
- `MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off
.agents/skills/mo-dev/scripts/mo-cgo-test -v -cover -count=1
-timeout=120s -run
'^(TestMemoryCachePressureAdmissionAdmitsGhostEntry|TestObjectStorages)$'
./pkg/fileservice`
- `MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=240s
-skip '^TestMinioSDK$' ./pkg/fileservice`
- `GOWORK=off go build -mod=readonly ./pkg/fileservice`
- `GOWORK=off go vet -mod=readonly ./pkg/fileservice`
- `gofmt -d pkg/fileservice/mem_cache_test.go`
- `git diff --check`

### Residual risk / environment note

The local unfiltered package run remains unable to complete because the
locally started MinIO instance reports `XMinioStorageFull` and `Access
Denied` in `TestMinioSDK`; this is an environment failure unrelated to
this test-only diff. No QCloud credentials are configured locally, so
the external qcloud/minio branch of `TestObjectStorages` remains for CI
validation. No production code, API, or concurrency behavior changes.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to matrixorigin#27305

## What this PR does / why we need it:

### Root cause

`TestMemoryCachePressureAdmissionAdmitsGhostEntry` created foreign
`staticTestData` vectors and called `MemCache.Update`. Admission rehomes
foreign data into allocator-backed cache data and rewrites the vector
entry, so the vector remains the caller-owned reference that must be
released. The loop omitted that release.

The same test then called `DataCache.Get` to assert cache and ghost
membership. A successful `Get` retains the returned data through the
cache post-get callback. The test discarded each successful value,
leaving extra checked-allocator references alive. The later coverage
test allocator finalizer reported the leak as `missing free`.

### Changes

- Release each vector immediately after its update in the admission
loop.
- Add a local cache-membership helper that releases every retained value
returned by a successful `Get`, and use it for all membership assertions
in the test.
- Keep the production cache ownership contract and ghost-entry
assertions unchanged; this PR only corrects test-owned references.

### Issue-to-test proof

- matrixorigin#27305: The existing
`TestMemoryCachePressureAdmissionAdmitsGhostEntry` covers pressure
admission, eviction, ghost replacement, and hit/miss membership. The
test now closes both ownership edges that triggered the checked
allocator report.
- Before the change, an isolated forced-GC reproduction of the same
vector admission path terminated with `CheckedAllocator: missing free`;
after the change, the target test passes with allocator checking and
aggressive GC.

### Verification

- `MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s -run
'^TestMemoryCachePressureAdmissionAdmitsGhostEntry$' ./pkg/fileservice`
- `MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off
.agents/skills/mo-dev/scripts/mo-cgo-test -v -cover -count=1
-timeout=120s -run
'^(TestMemoryCachePressureAdmissionAdmitsGhostEntry|TestObjectStorages)$'
./pkg/fileservice`
- `MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=240s
-skip '^TestMinioSDK$' ./pkg/fileservice`
- `GOWORK=off go build -mod=readonly ./pkg/fileservice`
- `GOWORK=off go vet -mod=readonly ./pkg/fileservice`
- `gofmt -d pkg/fileservice/mem_cache_test.go`
- `git diff --check`

### Residual risk / environment note

The local unfiltered package run remains unable to complete because the
locally started MinIO instance reports `XMinioStorageFull` and `Access
Denied` in `TestMinioSDK`; this is an environment failure unrelated to
this test-only diff. No QCloud credentials are configured locally, so
the external qcloud/minio branch of `TestObjectStorages` remains for CI
validation. No production code, API, or concurrency behavior changes.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [x] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to matrixorigin#27305

## What this PR does / why we need it:

### Root cause

`TestMemoryCachePressureAdmissionAdmitsGhostEntry` created foreign
`staticTestData` vectors and called `MemCache.Update`. Admission rehomes
foreign data into allocator-backed cache data and rewrites the vector
entry, so the vector remains the caller-owned reference that must be
released. The loop omitted that release.

The same test then called `DataCache.Get` to assert cache and ghost
membership. A successful `Get` retains the returned data through the
cache post-get callback. The test discarded each successful value,
leaving extra checked-allocator references alive. The later coverage
test allocator finalizer reported the leak as `missing free`.

### Changes

- Release each vector immediately after its update in the admission
loop.
- Add a local cache-membership helper that releases every retained value
returned by a successful `Get`, and use it for all membership assertions
in the test.
- Keep the production cache ownership contract and ghost-entry
assertions unchanged; this PR only corrects test-owned references.

### Issue-to-test proof

- matrixorigin#27305: The existing
`TestMemoryCachePressureAdmissionAdmitsGhostEntry` covers pressure
admission, eviction, ghost replacement, and hit/miss membership. The
test now closes both ownership edges that triggered the checked
allocator report.
- Before the change, an isolated forced-GC reproduction of the same
vector admission path terminated with `CheckedAllocator: missing free`;
after the change, the target test passes with allocator checking and
aggressive GC.

### Verification

- `MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=120s -run
'^TestMemoryCachePressureAdmissionAdmitsGhostEntry$' ./pkg/fileservice`
- `MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off
.agents/skills/mo-dev/scripts/mo-cgo-test -v -cover -count=1
-timeout=120s -run
'^(TestMemoryCachePressureAdmissionAdmitsGhostEntry|TestObjectStorages)$'
./pkg/fileservice`
- `MO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off
.agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=240s
-skip '^TestMinioSDK$' ./pkg/fileservice`
- `GOWORK=off go build -mod=readonly ./pkg/fileservice`
- `GOWORK=off go vet -mod=readonly ./pkg/fileservice`
- `gofmt -d pkg/fileservice/mem_cache_test.go`
- `git diff --check`

### Residual risk / environment note

The local unfiltered package run remains unable to complete because the
locally started MinIO instance reports `XMinioStorageFull` and `Access
Denied` in `TestMinioSDK`; this is an environment failure unrelated to
this test-only diff. No QCloud credentials are configured locally, so
the external qcloud/minio branch of `TestObjectStorages` remains for CI
validation. No production code, API, or concurrency behavior changes.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

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

Labels

kind/bug Something isn't working kind/test-ci size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants