microsoft/FASTER · error · FasterException
LockableContext requires
Error message
LockableContext requires {nameof(ConcurrencyControlMode.LockTable)} What it means
ClientSession.LockableContext supports manual record locking, which only works when the store was created with ConcurrencyControlMode.LockTable. If the lock table is disabled the property throws FasterException, since lock acquisition/release on the returned context could not be honored.
Solutions
- Set ConcurrencyControlMode = ConcurrencyControlMode.LockTable in FasterKVSettings before constructing FasterKV.
- If manual locking is not needed, use the normal Context returned from NewSession instead.
- Check fht.LockTable.IsEnabled before accessing LockableContext to fail fast with a clearer message.
Example fix
// before
var kv = new FasterKV<Key, Value>(new FasterKVSettings<Key, Value>(path));
var lctx = session.LockableContext; // throws
// after
var kv = new FasterKV<Key, Value>(new FasterKVSettings<Key, Value>(path) { ConcurrencyControlMode = ConcurrencyControlMode.LockTable });
var lctx = session.LockableContext; // ok Defensive patterns
Strategy: validation
Validate before calling
if (!fht.LockTable.IsEnabled)
throw new InvalidOperationException("LockableContext requires ConcurrencyControlMode.LockTable");
var lctx = session.LockableContext; Type guard
bool SupportsManualLocking<TKey, TValue>(FasterKV<TKey, TValue> fht) => fht?.LockTable?.IsEnabled == true;
Try / catch
try
{
var lctx = session.LockableContext;
}
catch (FasterException ex) when (ex.Message.Contains("LockTable"))
{
// fallback: use regular session context without manual locks
} Prevention
- Keep a single store-configuration module so LockTable mode is never forgotten.
- Document the LockTable prerequisite next to every LockableContext usage.
- Assert LockTable.IsEnabled in application startup checks.
When it happens
Trigger: Reading LockableContext on a session whose FasterKV was constructed with ConcurrencyControlMode.None, so fht.LockTable.IsEnabled is false.
Common situations: Default FasterKVSettings used (ConcurrencyControlMode.None); migrating code that needs manual locking to an existing store instance that was not configured with LockTable.
Related errors
- LockableUnsafeContext requires
- Unexpected sealed buffer found
- Invalid release by non-owner thread
- Out of order message within session
- Unexpected status of SubscribeKV
AI-assisted analysis of microsoft/FASTER@321d872eab (2026-09-15).
Data as JSON: /api/errors/aec4795a18ca8aab.
Report an issue: GitHub.
Appendix: source
Thrown at cs/src/core/ClientSession/ClientSession.cs:257
public LockableUnsafeContext<Key, Value, Input, Output, Context, Functions> LockableUnsafeContext
{
get
{
if (!this.fht.LockTable.IsEnabled)
throw new FasterException($"LockableUnsafeContext requires {nameof(ConcurrencyControlMode.LockTable)}");
return luContext;
}
}
/// <summary>
/// Return a session wrapper that supports manual locking.
/// </summary>
public LockableContext<Key, Value, Input, Output, Context, Functions> LockableContext
{
get
{
if (!this.fht.LockTable.IsEnabled)
throw new FasterException($"LockableContext requires {nameof(ConcurrencyControlMode.LockTable)}");
return lContext;
}
}
/// <summary>
/// Return a session wrapper struct that passes through to client session
/// </summary>
public BasicContext<Key, Value, Input, Output, Context, Functions> BasicContext => bContext;
#region IFasterContext
/// <inheritdoc/>
public long GetKeyHash(Key key) => fht.GetKeyHash(ref key);
/// <inheritdoc/>
public long GetKeyHash(ref Key key) => fht.GetKeyHash(ref key);
/// <inheritdoc/>View on GitHub (pinned to 321d872eab)