test: align PB memory leak check with RecordSet lifecycle#9
Merged
zanmato1984 merged 1 commit intomasterfrom Apr 12, 2026
Merged
Conversation
Signed-off-by: Rossi Sun <zanmato1984@gmail.com>
76a6b44 to
3807537
Compare
Owner
Author
|
Role: Coder-R251 Rewrote the single PR commit with DCO signoff and force-with-lease pushed the branch to clear the DCO gate for fresh review. |
zanmato1984
commented
Apr 12, 2026
Owner
Author
zanmato1984
left a comment
There was a problem hiding this comment.
Role: Reviewer-R1
Verdict: LGTM
Checks performed:
- Lifecycle boundary correctness: confirmed the test now closes the RecordSet before post-read memory assertions, matching the cleanup contract.
- Result-set handling safety: verified a single-result expectation is asserted before indexing (
require.Len(records, 1)). - Resource-release guarantee: verified
record.Close()is deferred in a bounded closure, covering normal EOF and fail-fast paths. - Assertion validity after refactor: confirmed row-count validation still executes and memory assertions still verify allocation growth plus post-read in-use stabilization.
- Scope/regression check: change is isolated to one unstable test file and does not alter production code paths.
- PR hygiene and CI: verified DCO signoff on the commit and all required GitHub checks passing on this head SHA.
No material blocking issues found in the current PR state.
Note: GitHub does not allow approving your own PR from this account, so this is posted as a review comment rather than an approval event.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Role: Coder-R251
Problem
The PB memory leak coverage checks post-read memory behavior around a result-set lifecycle, but the test was not closing the result set before making the final memory assertions. That leaves the coverage misaligned with the intended cleanup contract.
Root Cause
RecordSet.Close()is part of the expected lifecycle contract here. Reaching EOF is not the same thing as reaching lifecycle end: the lower-level response resource is already released at EOF, but the higher-level record-set / executor state is only cleared whenClose()/Finish()runs. A local timing-window validation around that boundary substantially confirmed that this is the decisive boundary for the memory symptom exercised by the test.Fix
Update
TestPBMemoryLeakto assert a single result set, drain it, deferRecordSet.Close(), and only then run the post-read memory assertions.Validation
env GOCACHE=/tmp/go-build-omar go test --tags=intest,deadlock ./pkg/executor/test/unstabletest -run ^TestPBMemoryLeak -count=1env GOCACHE=/tmp/go-build-omar go test --tags=intest,deadlock ./pkg/executor/test/unstabletest -run ^TestPBMemoryLeak -count=5Close()and its collapse afterClose().Scope
This strongly validates
Close()as the decisive boundary for the memory symptom covered by this test. It does not overclaim universal certainty for every historical fluctuation outside this validated path.