Repository navigation
test(fileservice): release memory cache test data - #27426
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
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.
Merge Queue Status
This pull request spent 2 hours 48 minutes 40 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull 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.
Failing checks:
HintYou 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. Tick the box to put this pull request back in the merge queue (same as
|
## 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>
## 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>
## 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>
What type of PR is this?
Which issue(s) this PR fixes:
Related to #27305
What this PR does / why we need it:
Root cause
TestMemoryCachePressureAdmissionAdmitsGhostEntrycreated foreignstaticTestDatavectors and calledMemCache.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.Getto assert cache and ghost membership. A successfulGetretains 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 asmissing free.Changes
Get, and use it for all membership assertions in the test.Issue-to-test proof
TestMemoryCachePressureAdmissionAdmitsGhostEntrycovers pressure admission, eviction, ghost replacement, and hit/miss membership. The test now closes both ownership edges that triggered the checked allocator report.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/fileserviceMO_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/fileserviceMO_MALLOC_DEBUG=1 GOGC=1 GOWORK=off .agents/skills/mo-dev/scripts/mo-cgo-test -v -count=1 -timeout=240s -skip '^TestMinioSDK$' ./pkg/fileserviceGOWORK=off go build -mod=readonly ./pkg/fileserviceGOWORK=off go vet -mod=readonly ./pkg/fileservicegofmt -d pkg/fileservice/mem_cache_test.gogit diff --checkResidual risk / environment note
The local unfiltered package run remains unable to complete because the locally started MinIO instance reports
XMinioStorageFullandAccess DeniedinTestMinioSDK; this is an environment failure unrelated to this test-only diff. No QCloud credentials are configured locally, so the external qcloud/minio branch ofTestObjectStoragesremains for CI validation. No production code, API, or concurrency behavior changes.