crossbeam-skiplist: fix RefRange iterator memory leak (#19284)#19293
Conversation
RefRange::next() and next_back() were using clone_from() to update self.head/self.tail. Since RefEntry has no Drop implementation, the old entry was dropped without decrementing its refcount, causing permanent memory leaks. Fix by using mem::replace() and manually calling decrement() on the old entry, matching the pattern used in RefIter::next(). Signed-off-by: ekexium <eke@fastmail.com>
Signed-off-by: ekexium <eke@fastmail.com>
…pments. (tikv#19248) ref tikv#19249 Upgrades the `cargo-deny` version and ignore some errors. Signed-off-by: lucasliang <nkcs_lykx@hotmail.com>
ref tikv#19249 Fix the CI by ignoring `RUSTSEC-2026-0002`. Signed-off-by: you06 <you1474600@gmail.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfzjywxk, overvenus The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
d25f155
into
tikv:release-8.5-20251208-v8.5.4
|
@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