crossbeam-skiplist: fix RefRange iterator memory leak (#19284)#19309
crossbeam-skiplist: fix RefRange iterator memory leak (#19284)#19309ti-chi-bot wants to merge 1 commit intotikv:release-7.1from
Conversation
close tikv#19285 Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
This cherry pick PR is for a release branch and has not yet been approved by triage owners. To merge this cherry pick:
DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@ti-chi-bot: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
This is an automated cherry-pick of #19284
What is changed and how it works?
Issue Number: Close #19285
What's Changed:
Fix a memory leak in
crossbeam-skiplist'sRefRangeiterator.RefRange::next()andnext_back()were usingclone_from()to updateself.head/self.tail. SinceRefEntryhas noDropimplementation (by design - callers must explicitly callrelease()), the old entry was dropped without decrementing its refcount, causing permanent memory leaks.Note that the the comment of
RefEntrysaysThis bug affects any code using
SkipMap::range()iterators. In TiKV, this manifests as memory leaks inLockTablewhencheck_range()orfind_first()are called.The fix matches the pattern already used in
RefIter::next().Stress test results (10 seconds, range iteration + insert/remove cycle):
Related changes
pingcap/docs/pingcap/docs-cn:Check List
Tests
Side effects
Release note