microsoft/FASTER · error · FasterException
Can spin-wait for commit (checkpoint completion) only if…
Error message
Can spin-wait for commit (checkpoint completion) only if wait is true
What it means
CompletePending(spinWaitForCommit: true) blocks by spinning until a checkpoint/commit finishes, which is only meaningful when the call itself blocks (wait: true). Passing spinWaitForCommit with wait=false would spin on a non-blocking call, so FASTER rejects the combination immediately.
Solutions
- Pass wait: true when using spinWaitForCommit: true.
- If you do not need to block, drop spinWaitForCommit and call CompletePending(wait: false).
- For async scenarios use CompletePendingAsync(waitForCommit: true) instead of spinning.
Example fix
// before session.CompletePending(wait: false, spinWaitForCommit: true); // throws // after session.CompletePending(wait: true, spinWaitForCommit: true);
Defensive patterns
Strategy: validation
Validate before calling
bool wait = true, spinWaitForCommit = true;
if (spinWaitForCommit && !wait)
throw new ArgumentException("spinWaitForCommit requires wait: true");
session.CompletePending(wait, spinWaitForCommit); Try / catch
try
{
session.CompletePending(wait, spinWaitForCommit);
}
catch (FasterException ex) when (ex.Message.Contains("spin-wait"))
{
session.CompletePending(wait: true, spinWaitForCommit: true);
} Prevention
- Avoid positional booleans; use named arguments for CompletePending.
- Wrap session completion in a helper with a valid default combination.
- Review call sites that toggle 'wait' to false for leftover spinWaitForCommit flags.
When it happens
Trigger: Calling session.CompletePending(wait: false, spinWaitForCommit: true) (or the CompletePendingWithoutCommit spinWait variant) on a ClientSession.
Common situations: Developers copy a CompletePending(wait: true, spinWaitForCommit: true) call and change wait to false to avoid blocking, forgetting the spinWaitForCommit flag still set; boolean flags passed positionally in the wrong order.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- Unable to set first valid segment to
- Unable to set last valid segment to
- Make sure all async operations issued on this session are…
- Invalid number of chunks:
- Error flushing page to device
AI-assisted analysis of microsoft/FASTER@321d872eab (2026-09-15).
Data as JSON: /api/errors/b1853cb2f2117a2c.
Report an issue: GitHub.
Appendix: source
Thrown at cs/src/core/ClientSession/ClientSession.cs:856
try
{
return UnsafeCompletePending(FasterSession, getOutputs, wait, spinWaitForCommit);
}
finally
{
UnsafeSuspendThread();
}
}
internal bool UnsafeCompletePending<FasterSession>(FasterSession fasterSession, bool getOutputs, bool wait, bool spinWaitForCommit)
where FasterSession : IFasterSession<Key, Value, Input, Output, Context>
{
var requestedOutputs = getOutputs ? this.completedOutputs : default;
var result = fht.InternalCompletePending(fasterSession, wait, requestedOutputs);
if (spinWaitForCommit)
{
if (!wait)
throw new FasterException("Can spin-wait for commit (checkpoint completion) only if wait is true");
do
{
fht.InternalCompletePending(fasterSession, wait, requestedOutputs);
if (fht.InRestPhase())
{
fht.InternalCompletePending(fasterSession, wait, requestedOutputs);
return true;
}
} while (wait);
}
return result;
}
/// <inheritdoc/>
public ValueTask CompletePendingAsync(bool waitForCommit = false, CancellationToken token = default)
=> CompletePendingAsync(false, waitForCommit, token);
/// <inheritdoc/>View on GitHub (pinned to 321d872eab)