You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[engine] suspendFlushAndExecute ownership is first-caller-wins: concurrent callers (backup, verify, snapshot) can observe a resumed flush mid-read #5068
Found and partially fixed during PR #5063 review round 5. PageManagerFlushThread.setSuspended(db, true) is putIfAbsent-based: only the FIRST caller owns the suspension, but suspendFlushAndExecute runs every caller's callback regardless. A concurrent NON-owning caller (a) skips waitForCurrentFlushToComplete, so it can read files while a flush batch is mid-write, and (b) keeps streaming while the owner's exit synchronously flushes the deferred batches - torn reads either way.
PR #5063 serialized the HA snapshot path (SnapshotHttpHandler per-database lock), but the exposure is general across suspension users that can overlap on the same database:
SQL BACKUP DATABASE (FullBackupFormat)
PostVerifyDatabaseHandler
HA snapshot serving (now serialized among themselves, but not against the other two)
Proper fix: refcounted suspension in PageManager - suspend while refcount > 0, resume (and flush deferred) only when the LAST suspender exits; every caller then legitimately owns its window. Needs care with the deferred-RAM backpressure accounting (#4728) and the suspend-owner bookkeeping added in #5012.
Discovered during the 2026-07 audit follow-up (#4962).
Fixed in #5074 (merged). Page-flush suspension is now refcounted: every suspendFlushAndExecute caller owns its window - suspension holds while the count is above zero and the resume (Phase-1 flush of the deferred batches) runs only when the LAST suspender exits, so an overlapping backup/verify/snapshot can no longer observe a resumed flush mid-read. Composes with the #4728 deferred-RAM backpressure and the #5012 suspend bookkeeping; the HA SnapshotHttpHandler's per-database lock stays (it also serializes the zip streaming itself). The review round additionally hardened an interrupt-during-wait suspension leak with a deterministic red-first test, and documented the bounded stalled-resume tradeoff against the actual callers.
Activity
Merge pull request #5074 from ArcadeData/fix/5068-refcounted-flush-su…
lvca commentedon Jul 7, 2026
Fixed in #5074 (merged). Page-flush suspension is now refcounted: every suspendFlushAndExecute caller owns its window - suspension holds while the count is above zero and the resume (Phase-1 flush of the deferred batches) runs only when the LAST suspender exits, so an overlapping backup/verify/snapshot can no longer observe a resumed flush mid-read. Composes with the #4728 deferred-RAM backpressure and the #5012 suspend bookkeeping; the HA SnapshotHttpHandler's per-database lock stays (it also serializes the zip streaming itself). The review round additionally hardened an interrupt-during-wait suspension leak with a deterministic red-first test, and documented the bounded stalled-resume tradeoff against the actual callers.
fix(ArcadeData#5068): refcount page-flush suspension so overlapping s…
fix(#5068): refcount page-flush suspension so overlapping suspenders …
review: restore instant overlapping-window acquisition in suspendFlus…