microsoft/FASTER · error · FasterException

Invalid release by non-owner thread

Error message

Invalid release by non-owner thread

What it means

AtomicOwner tracks which epoch/owner thread holds a page buffer during flush/drain. Release is only legal by the owning thread; if the owner field is 0 (nobody owns it) when SuspendDrain calls Release, the internal ownership invariant is broken and it throws. This is an internal concurrency-invariant violation, usually caused by epoch/flush machinery misuse rather than user code.

Solutions

  1. Ensure all store operations (including suspend/maintenance APIs) run under FASTER's epoch management: use its session/thread-pool conventions and call SuspendDrain from a single coordinated thread.
  2. Avoid concurrent SuspendDrain/Resume calls; serialize maintenance operations.
  3. Upgrade FASTER to the latest patch - some owner/epoch races were fixed in later versions.

Example fix

// before
// two maintenance threads calling suspend concurrently
ThreadPool.QueueUserWorkItem(_ => store.Log.SuspendDrain());
ThreadPool.QueueUserWorkItem(_ => store.Log.SuspendDrain());

// after
// serialize maintenance on one thread/lock
lock (maintLock) { store.Log.SuspendDrain(); ... store.Log.ResumeDrain(); }
Defensive patterns

Strategy: try-catch

Try / catch

try { log.SuspendDrain(); }
catch (FasterException ex) when (ex.Message.Contains("non-owner thread")) {
    // serialize maintenance: ensure only one thread performs suspend/drain
}

Prevention

When it happens

Trigger: SuspendDrain -> Release invoked when the page ownership was already cleared (owner == 0) - typically from an epoch mis-drain, double-release, or a background flush completing out of order relative to thread suspension.

Common situations: Custom epoch/pooled thread management around the store; calling APIs that suspend drain from multiple threads concurrently; races exposed when tuning checkpoint/maintenance logic.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of microsoft/FASTER@321d872eab (2026-09-15). Data as JSON: /api/errors/d2fa094c204b2ebf. Report an issue: GitHub.

Appendix: source

Thrown at cs/src/core/Allocator/AtomicOwner.cs:80

        /// <summary>
        /// Release queue ownership
        /// true: successful release
        /// false: failed release
        /// </summary>
        /// <returns></returns>
        public bool Release()
        {
            while (true)
            {
                var older = this;
                var newer = older;

                if (newer.count > 0)
                    return false;

                if (newer.owner == 0)
                    throw new FasterException("Invalid release by non-owner thread");
                newer.owner = 0;

                if (Interlocked.CompareExchange(ref this.atomic, newer.atomic, older.atomic) == older.atomic)
                {
                    return true;
                }
            }
        }
    }
}

View on GitHub (pinned to 321d872eab)