Skip to content

Construct server engines on their owner worker - #2111

Merged
justinchuby merged 1 commit into
mainfrom
justinchuby/engine-owner-thread
Aug 25, 2026
Merged

justinchuby merged 1 commit into
mainfrom
justinchuby/engine-owner-thread

Conversation

@justinchuby

Copy link
Copy Markdown
Owner

Summary

  • construct each Engine inside its single owner worker and return a typed readiness result
  • remove EngineOwner and forbid unsafe code in the server crate
  • propagate initialization failures/panics/startup failures while preserving joined teardown, registry unload/drop, and in-flight handles
  • keep model parsing and other Send-safe load data outside the worker

Scope

This is the owner-thread lifecycle prerequisite only. It preserves the #2056 global lease/session routing and #2044 state split. W = 1; this PR makes no concurrency, parallel execution, or batching claim.

Tests

  • cargo test -p onnx-genai-server --lib (319 passed, 2 ignored)
  • cargo test -p onnx-genai-server --test http (40 passed, 1 ignored)
  • cargo test -p onnx-genai-server --lib session (50 passed)
  • cargo test -p onnx-genai-server --lib unload (7 passed)
  • targeted worker initialization and engine lifecycle tests
  • cargo fmt --all -- --check
  • cargo clippy -p onnx-genai-server --all-targets -- -D warnings

Pass a Send-safe load closure into each worker and wait for a typed readiness handshake, so Engine construction, execution, failure unwind, and destruction all stay on the owner OS thread. Remove EngineOwner and forbid unsafe code in the server while preserving the single-worker routing and shutdown contracts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.14%. Comparing base (6caef22) to head (2513f1f).
⚠️ Report is 40 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2111      +/-   ##
==========================================
+ Coverage   80.30%   81.14%   +0.84%     
==========================================
  Files         426      429       +3     
  Lines      205244   215150    +9906     
  Branches   205244   215150    +9906     
==========================================
+ Hits       164811   174578    +9767     
- Misses      34781    34797      +16     
- Partials     5652     5775     +123     
Flag Coverage Δ
cli-ort-linux 72.51% <ø> (?)
cli-ort-windows 72.01% <ø> (-0.10%) ⬇️
mlas 86.02% <ø> (?)
offline 81.28% <ø> (+0.76%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 65 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@justinchuby
justinchuby merged commit cf23d0e into main Aug 25, 2026
15 of 18 checks passed
@justinchuby
justinchuby deleted the justinchuby/engine-owner-thread branch August 25, 2026 13:55
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.

2 participants