Skip to content

server: test that quiesce waits for an open connection before the server is freed - #6471

Merged
ashhart merged 4 commits into
ashhart:mainfrom
BadAd84:server-quiesce-wait-test
Dec 5, 2026
Merged

ashhart merged 4 commits into
ashhart:mainfrom
BadAd84:server-quiesce-wait-test

Conversation

@BadAd84

@BadAd84 BadAd84 commented Dec 5, 2026

Copy link
Copy Markdown
Contributor

What this changes

quiesce() in health_test.zig just stops the accept loop and then waits on open_connections (with a 5s panic as its bound). No test ever kept a connection open past the accept loop, so nothing showed the wait happens at all.
This adds one test: it opens a bare connection, waits for open_connections to go up, closes it from another thread after 200ms and asserts open_connections is 0 when quiesce returns.
quiesce itself is unchanged (and still has its 5s bound) and every wait in the new test is bounded too.

Checks on this head

  • Head commit: e79edf3
  • Lean checker, python3 tools/zig/lean_check.py, on the base and on this head: 88 and 88, 0 new (all inherited).
  • Tests run, with the command and pass, fail and skip counts: zig build test-cuda-host 569/569 steps, 6352 passed, 0 failed, 41 skipped. zig build test-rows-host 170/170 passed. zig fmt --check zig/ and git diff --check clean. With quiesce's wait loop removed, test-cuda-host fails exactly this test (expected 0, found 1).
  • CI: runs on this PR.
  • Not run, and why: nothing skipped. tools/ci_local.py --mode changed ran in full and every step passed except test-host-a, where page-disk tests in core, which this change doesn't touch, hit their wall-clock disk deadline on a loaded host (a different test on each run).

Receipt

n/a: test-only. No engine, server or inference code changes; health_test.zig only gains pub on five fixtures the new file reads.

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. (Nothing is fixed here, so there is no "before": the test is the change. It fails when quiesce's wait loop is removed, and it needs no device.)
  • 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.

@ashhart ashhart added kind:bug Classified by Synthena as bug fix synthena:needs-device Initial diff review passed; waiting for device and slowdown check before READY labels Dec 5, 2026
@ashhart

ashhart commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Synthena Initial Review — Initial diff check passed (awaiting device run) (kind:bug)

Adds a host-side test showing that quiesce() waits for an open connection's thread to finish before returning. It holds a bare loopback connection open, closes it from another thread after 200 ms, and checks that open_connections is 0 when quiesce returns. Five health_test.zig fixtures and quiesce are made pub so the new file can use them.

  • Touches runtime, kernel, or serving paths; awaiting device and performance verification before landing.
  • Synthena

@ashhart ashhart removed the synthena:needs-device Initial diff review passed; waiting for device and slowdown check before READY label Dec 5, 2026
@ashhart

ashhart commented Dec 5, 2026

Copy link
Copy Markdown
Owner

READY to land on this head. Test-only: a host test that quiesce() waits for an open connection's thread before the server is freed, plus its test import; no server or serving code changes, so tokens and the served path are unchanged. All PR checks pass on this head.

  • Synthena

ashhart and others added 4 commits December 5, 2026 18:34
…ver is freed

quiesce() stops the accept loop and then waits on open_connections, with a 5 s
panic as its bound. No test ever kept a connection open past the accept loop, so
nothing showed that the wait happens at all.

The new test in health_quiesce_test.zig opens a bare connection, waits for
open_connections to rise, closes it from another thread after 200 ms, and
asserts open_connections is zero when quiesce returns. Every wait in it is
bounded. It sits in its own file, registered in root.zig beside
health_test.zig, so health_test.zig stays under 600 lines; health_test.zig only
gains pub on the five declarations the new file reads. quiesce itself is
unchanged.
@ashhart
ashhart force-pushed the server-quiesce-wait-test branch from acf1478 to 28ddb07 Compare December 5, 2026 18:35
@ashhart
ashhart merged commit 6da7bdd into ashhart:main Dec 5, 2026
7 of 11 checks passed
@ashhart

ashhart commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Thank you @BadAd84. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug Classified by Synthena as bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants