Skip to content

Wait for ONNX Runtime work before aft warmup and aft index exit - #1495

Merged
ualtinok merged 2 commits into
mainfrom
fix/ort-cli-exit-quiesce
Nov 23, 2026
Merged

ualtinok merged 2 commits into
mainfrom
fix/ort-cli-exit-quiesce

Conversation

@aft-alfonso

@aft-alfonso aft-alfonso Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

The 0.67.0 release stopped at its macOS check: aft warmup built the meaning-search index, printed that it was ready, and then crashed at exit with SIGSEGV (exit 139). Nothing was published.

Cause, from a symbolized crash report of the shipped binary: warmup's status polling had started a second fill round, which was creating an ONNX Runtime session when warmup returned from main. The process exit then ran ONNX Runtime's C++ static destructors underneath that thread. The long-running server and daemon already wait for in-flight ONNX Runtime work before they exit; the one-shot warmup and index commands did not.

Fix: both commands now end through one helper, run_ort_capable_command in main.rs, which refuses new ONNX Runtime work and waits for work in flight (as the other shutdown paths do), then exits with the same code and output as before. No other CLI command loads ONNX Runtime.

Test: cli_ort_exit_test holds a fill inside model creation through a test-hooks-only hook and checks that warmup does not end until the fill leaves ONNX Runtime. It fails against the old main.rs and passes with the fix.

The search-quality descriptor marks this non-ranking: the only change in data_layer/meaning.rs is that test hook.


Summary by cubic

Fixes a crash in aft warmup and aft index that stopped the 0.67.0 release at its macOS check: both commands ended while a background fill was still creating an ONNX Runtime session, so the process exit ran ORT's C++ static destructors under that thread and died with SIGSEGV (exit 139) after printing its output.

Both commands now end through a shared helper, run_ort_capable_command in main.rs, that refuses new ONNX Runtime work and waits for work in flight, mirroring the existing server and daemon shutdown paths. Exit codes and output are unchanged. The only change in data_layer/meaning.rs is a test-hooks-only hold that release builds do not compile.

Testing

  • Added cli_ort_exit_test, which keeps a fill inside ONNX Runtime model creation and verifies warmup does not exit until the fill leaves the section; it fails against the old main.rs and passes with the fix.

Written for commit de59ca6. Summary will update on new commits.

View guided diff Turn on auto-fix

RetriggerView in GreptileConfidence Score: 4/5

The change appears safe to merge, with a non-blocking gap in successful-exit test coverage.

Findings

  1. P2 Successful exits lack coverage ▶

Summary

Routes aft warmup and aft index through run_ort_capable_command before they exit.

  • Warmup and index wait for ONNX Runtime work before ending.

Review used source inspection; no tests were run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["warmup or index finishes"] --> B["run_ort_capable_command"]
  B --> C{"Exit code is 0?"}
  C -->|Yes| D["quiesce_before_return"]
  C -->|No| E["exit_process"]
  D --> F["Close gate and wait"]
  E --> F
  F --> G{"Active work finished?"}
  G -->|Yes| H["Normal return or exit"]
  G -->|No| I["Exit without native teardown"]
Loading

Reviews (1) · Last reviewed commit: "Clarify ONNX exit comments; add search-q..." · Reviewed by Greptile

ualtinok and others added 2 commits November 23, 2026 16:32
aft warmup and aft index returned from main (or called process::exit)
without the ONNX Runtime quiesce the standalone and supervised shutdowns
run. A meaning-search fill still creating its embedding session on a
background thread then ran into ORT's static destructors and the process
died with SIGSEGV (exit 139) after its output was complete, as in the
v0.67.0 macOS release smoke. Both commands now end through one helper
that waits for in-flight ORT sections first.

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
… exit fix

Co-authored-by: alfonso-aft <289616620+alfonso-aft@users.noreply.github.com>
@ualtinok
ualtinok merged commit bb7c6ac into main Nov 23, 2026
85 of 100 checks passed
@ualtinok
ualtinok deleted the fix/ort-cli-exit-quiesce branch November 23, 2026 15:41
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