Repository navigation
[Tsavorite] Do not wait for a stopped size tracker in NeedToWaitForClose during AOF replay - #2175
Closed
Federico Laurianti (Laurianti) wants to merge 2 commits into
Closed
Federico Laurianti (Laurianti) wants to merge 2 commits into
Federico Laurianti (Laurianti) wants to merge 2 commits into
Conversation
Copilot started reviewing on behalf of
Federico Laurianti (Laurianti)
September 27, 2026 13:50
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The timeout leaves startup running while teardown concurrently disposes its allocator resources.
Review effort: Balanced
Findings: 1
What changed in this PR
Prevents AOF recovery from livelocking when object heap usage exceeds budget before the size tracker starts.
Changes:
- Bypasses inactive size-tracker waits during page allocation.
- Adds an object-heavy AOF recovery regression test.
| File | Description |
|---|---|
AllocatorBase.cs |
Guards eviction signaling with IsRunning. |
RespAdminCommandsTests.cs |
Tests recovery above the heap budget. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Federico Laurianti (Laurianti)
force-pushed
the
fix-recovery-heap-overbudget-hang
branch
from
September 27, 2026 14:07
c4e851f to
5ce7cf5
Compare
Contributor
|
Thanks for the contribution! This has been consolidated into PR #2181 |
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.

Root Cause
During AOF replay the
LogSizeTrackerhas not been started yet.NeedToWaitForClosestill asks it to evict: whenIsBeyondSizeLimitAndCanEvict(addingPage: true)is true it callsSignal()and returns true, soTryAllocateRetryNowretries. If the log heap alone is over budget and the page count is belowMaxAllocatedPageCount,IssueShiftAddressdoes not shiftHeadAddresseither, and the retry loop never ends. Recovery hangs before the server binds its port. It needs objects (heap) over budget, so string-only data is not affected.#1932 added the
!logSizeTracker.IsRunningguard toIssueShiftAddressfor this reason;NeedToWaitForClosewas left without it.Description of Change
libs/storage/Tsavorite/cs/src/core/Allocator/AllocatorBase.cs:NeedToWaitForClosereturns false when the size tracker is not running, asIssueShiftAddressalready does. With a running tracker nothing changes.Tests
RespAdminCommandsTests.SeAofRecoverObjectsOverHeapBudgetTest: 2,000 hashes of 2 KB on alowMemoryserver with AOF, unclean dispose, then recover. LikeSeSaveRecoverMultipleKeysTest, it callsserver.Start()directly, so a regression shows up as a hang (without the change,--blame-hang-timeout 3maborts it); with the change, all values are recovered.SeAofRecover*andSeSaveRecover*(19 passed, 2 skipped),Tsavorite.test.recovery(246 passed),Tsavorite.test.hlog(596 passed),Garnet.test.extensions(536 passed), net10.0 Release on Windows, on currentmain.HSET,docker kill,docker start) recovers in about 2 seconds with all keys.Issues Fixed
Fixes #2174