Skip to content

flashnext host: a close with replies queued finishes each one, with no copy of the queue to fail - #2616

Merged
ashhart merged 2 commits into
mainfrom
lead/fn-host-close
Nov 8, 2026
Merged

ashhart merged 2 commits into
mainfrom
lead/fn-host-close

Conversation

@ashhart

@ashhart ashhart commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

What this changes

When a Flash Next server closes with replies still queued, its run loop copied the queue, cleared it and ended each copied reply as cancelled. If that copy failed for want of memory, the queue was cleared anyway. No queued reply heard finished, so each request thread waited in its mailbox for good. Shutdown itself stays bounded, but those threads never return. The loop now takes the queue whole, as the lane host's closeAll in core/lane_host_end.zig does, so the close path allocates nothing.

  • Issue: n/a. Found by an audit of waits that an error path can leave waiting; no issue was filed.
  • Stacked on: main.
  • atc overlap --json: no open pull request among the 100 most recently updated touches zig/src/native/flashnext_host.zig, and the branch is on current main.

Checks on this head

  • Head commit: e62f984a5 (8684399cf the fix and its test, e62f984a5 the CHANGELOG line).
  • Lean checker, on the base and on this head: 398 and 398, 0 new.
  • Tests run: zig build test-flashnext-driver-host on macOS, 4 passed, 0 failed, 0 skipped. The new test, a drained Flash Next host finishes every queued reply, even when it cannot copy the queue, arms a failing allocator at the close path's next allocation, then reads every reply's mailbox without blocking. On main it fails (replies left unheard) and does not hang.
  • CI: pending.
  • Not run: nothing else reaches this path. The Flash Next host is Metal only.

Receipt

  • Main against branch: n/a. It changes only how a closing server ends queued replies, which no decode or prompt cell reaches.
  • Boxes it reaches: the Flash Next host's close (zig/src/native/flashnext_host.zig).
  • New switch? None.
  • Environment: TensorFold main 52427c023, Zig 0.17.0, macOS on Apple Silicon (Metal), host tests only.
  • Paths and platforms: the native Flash Next host on macOS; run there.
  • Exactness, decode speed, prompt speed: n/a. No token path changes.
  • Licence of any new weights or drafter: n/a.

Checklist

  • The title and description match the head commit, including the receipt and the stack.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths in the diff or its commits. No AI attribution lines.

…o copy of the queue to fail

The run loop's closing path copied the queue, cleared it and finished the copy. When the copy failed for want of
memory, the queue was cleared anyway, so no queued reply heard finished and each request thread waited in its
mailbox for good. The queue is now taken whole, as the lane host's close does, so the path allocates nothing. A
host test arms the allocator to fail at that point and checks every mailbox without blocking.
@ashhart
ashhart force-pushed the lead/fn-host-close branch from e62f984 to efede6a Compare November 8, 2026 23:13
@ashhart
ashhart merged commit c689518 into main Nov 8, 2026
4 of 9 checks passed
@ashhart
ashhart deleted the lead/fn-host-close branch November 10, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant