Log exceptions escaping OnPagesClosedWorker - #2025
Merged
Tiago Nápoli (tiagonapoli) merged 2 commits intoAug 5, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds allocator-level logging for unhandled exceptions escaping the OnPagesClosedWorker background pipeline, improving Tsavorite observability of unrecoverable “page closing stalled” failures without altering control flow (exceptions are still rethrown).
Changes:
- Wrap
OnPagesClosedWorkerin atry/catchthat logs a critical message with key allocator state and rethrows. - Extract the existing worker loop into
OnPagesClosedWorkerCore()to keep the wrapper minimal.
kevin-montrose
approved these changes
Aug 5, 2026
Badrish Chandramouli (badrishc)
approved these changes
Aug 5, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c743170a-5362-4f06-b0a3-3f1e3c40017a
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Tiago Nápoli (tiagonapoli)
force-pushed
the
tiagonapoli/log-close-pipeline-exceptions
branch
from
August 5, 2026 20:10
2e40d2f to
71905f5
Compare
Tiago Nápoli (tiagonapoli)
merged commit Aug 5, 2026
9f2effa
into
microsoft:main
416 of 417 checks passed
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.
Summary
Adds logging for exceptions escaping
OnPagesClosedWorker. Observability only — no behavior change. Catch, log via the allocator's existinglogger, rethrow.Why
OngoingCloseUntilAddressis a work-ownership token. FromOnPagesClosed:A worker is spawned only on the
0 → non-zerotransition, and the only normal exit from the worker loop isCAS(ref OngoingCloseUntilAddress, 0, closeEndAddress). So an exception unwinding the worker leaves the token non-zero with no live worker — a state the pipeline cannot leave. Every laterOnPagesClosedsees a non-zero token, assumes an owner is running, extends the token and starts nothing.ClosedUntilAddressnever advances again, and the unboundedwhile (...) Thread.Yield()waits depending on it spin at 100% of a core indefinitely.Evidence
A node had a thread pegged inside
ResetCore's wait forClosedUntilAddressduring a replica attach:Allocator state from the dump:
ClosedUntilAddress = 16,777,216(frozen),OngoingCloseUntilAddress = 2,031,377,992,SafeHeadAddress = 2,031,377,992— 1.88 GiB of log that could never be closed.The logs from that node contain no Tsavorite entries at all, so which exception killed the worker is unknowable after the fact. That is the gap this PR closes.