Repository navigation
Fix memtable use-after-free in getLogFileInfoBySeq() - #230
Merged
Merged
Conversation
greensky00
force-pushed
the
junahn_pr2
branch
from
November 13, 2026 18:35
fb67aef to
d1082b0
Compare
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the log-file reference-handling change.
No open issues 🎉
What changed in this PR
This PR addresses a memtable use-after-free race in getLogFileInfoBySeq() by holding a log-file reference before reading sequence numbers.
Changes:
- Grab the log file before sequence-number checks to prevent concurrent memtable purging.
- Release the reference on not-found paths.
- Load a purged memtable when needed using a temporary extra reference.
| File | Description |
|---|---|
src/log_manifest.cc |
Adjusts reference acquisition, cleanup, and memtable loading in getLogFileInfoBySeq(). |
Review effort: Balanced
* Seq numbers of a log file were read before grabbing it, so the log reclaimer could purge (free) its memtable in the middle. * Grab the log file first, and release it on the not-found paths. * Load the purged memtable afterwards if needed, by grabbing it once more with the loading option and releasing the extra reference.
greensky00
force-pushed
the
junahn_pr2
branch
from
November 13, 2026 19:00
d1082b0 to
b70985f
Compare
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.
Seq numbers of a log file were read before grabbing it, so the log reclaimer could purge (free) its memtable in the middle.
Grab the log file first, and release it on the not-found paths.
Load the purged memtable afterwards if needed, by grabbing it once more with the loading option and releasing the extra reference.