Fix LiteRT worker request leaks and fail closed on interrupted cleanup - #527
Merged
Merged
Conversation
Contributor
|
Chat app preview removed for |
leehack
marked this pull request as ready for review
September 18, 2026 16:50
This was referenced Sep 18, 2026
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.
Summary
When a LiteRT-LM worker stopped during an outstanding request, the caller's response port and future could remain alive after CLI
run_end. Track and fail pending requests on worker termination, close their ports, observe unexpected worker exits/errors, and share concurrent disposal results. Preserve unverified-cleanup failures through free retries, cancellation races, and automatic backend routing instead of reporting success or replacing the failed runtime.Partially addresses #521. Native initialization latency remains a separate limitation: one preserved macOS Qwen run exceeded the unchanged 60-second limit, while subsequent runs completed in 48–52 seconds. No native runtime, pin, cache policy, or timeout threshold changes. Requested GPU placement is unverified.
Validation on
97223924ee9a02d61f19965c294c0665b847c066/ base9946295a77728f2c73e9f8454225f06eddbad122:56760ac7d4678b9cada5041b7a2ee327183d41861a64152dead8338a2392f8cd; model SHA256684d4d34adf7176eb47f6026ff65c33d42584737254e5524a8d1ad62edc21b98, revisionc23b16e43ada6ead533b12593fe500bbe268014f.High-risk surfaces: backendRuntime, regressionPolicy. Required independent exact-head review completed locally. PR-bound evaluator evidence is populated for PR #527 and the exact head/base below. The evaluator reports
unverifiedPrerequisites: local evidence is internally consistent, but authenticated auditor/App/environment/ruleset prerequisites are unavailable. All 16 hosted checks passed on this exact head; live review threads total zero. No external authenticated readiness claim is made here. Other devices/platforms were not real-model tested for this change. Blocking native FFI calls still require an outer process deadline in CLI validation.Production-readiness scope
Completeness checklist
Test Plan
dart run tool/prepare_workspace.dartdart format --output=none --set-exit-if-changed .dart analyzedart test -p vm -j 1 --exclude-tags local-only --coverage=.dart_tool/issue521/coverage-refresh-9946295dart test -p chrome --exclude-tags local-onlyMatrix Evidence
High-risk regression review
01a0b507-c270-7141-b98c-840c72ecca55./root/audit_521.97223924ee9a02d61f19965c294c0665b847c066/9946295a77728f2c73e9f8454225f06eddbad122.Review Notes
Independent exact-head review accepted with zero P1/P2 findings. This remains a narrow cleanup fix; #521 is not closed by it. All hosted CI checks passed on the real PR head. This PR remains draft; no mark-ready or merge authorization.