Repository navigation
Wait for ONNX Runtime work before aft warmup and aft index exit - #1495
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 0.67.0 release stopped at its macOS check:
aft warmupbuilt 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-shotwarmupandindexcommands did not.Fix: both commands now end through one helper,
run_ort_capable_commandinmain.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_testholds 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 oldmain.rsand passes with the fix.The search-quality descriptor marks this non-ranking: the only change in
data_layer/meaning.rsis that test hook.Summary by cubic
Fixes a crash in
aft warmupandaft indexthat 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_commandinmain.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 indata_layer/meaning.rsis a test-hooks-only hold that release builds do not compile.Testing
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 oldmain.rsand passes with the fix.Written for commit de59ca6. Summary will update on new commits.
The change appears safe to merge, with a non-blocking gap in successful-exit test coverage.
Findings
Summary
Routes
aft warmupandaft indexthroughrun_ort_capable_commandbefore they exit.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"]Reviews (1) · Last reviewed commit: "Clarify ONNX exit comments; add search-q..." · Reviewed by Greptile