Skip to content

fix(emulator): retire stopped Android stream starts - #35607

Closed
OrcaWin wants to merge 1 commit into
mainfrom
audit/android-stream-start-retirement
Closed

OrcaWin wants to merge 1 commit into
mainfrom
audit/android-stream-start-retirement

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​135 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​135
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​33 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​26

Stopping an Android helper during jar download or stream handshake can return before a handle exists; startup later stores that handle and reports success, leaving a live stream after stop. A subsequent start also joins the obsolete request.

Mark pending starts stopped, skip downstream startup after jar completion, close late handles, and wait for prior teardown before starting a replacement. Keep healthy deduplication, live reuse, retry and idempotent stop. Active ADB/download/handshake I/O is not cancelled; the successor waits for its existing completion.

Validation:34 tests/five suites, parent four regressions fail/two controls pass, strict focused TypeScript and all five normal precommit tasks. Real Node/Linux child+TCP matrix at N=1/10:33 obsolete helpers/66 peers retained→zero;11 jar starts avoided and11 fresh replacements correctly serialized. Healthy/retry controls preserved; all132 matrix helper PIDs, sockets, servers and profiles released. Exact committed bundle rebuild is byte-identical. No actual device/ADB/ElectronUI/macOS/Windows/CPU/RSS/latency claim.

Preserve #35518 video retirement, #35490 GOP replay, #35531 logs, #35566 process policy and #35599 command runner on rebase. Evidence:/home/neil/.local/state/orca-electron-audit/android-stream-start-retirement/report.md

Required pnpm check:changed --maxWorkers=2 is queued after #35599. No aggregate/CI pass or merge claimed; keep draft until gate passes and revalidate current main before merge.

@OrcaWin

OrcaWin commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for this. I'm closing it because the normal pane/detach path already serializes stop after pending starts via EmulatorStartLeaseRegistry. The race only shows up when a CLI kill/shutdown or an app quit lands during the jar download or scrcpy handshake, and in those cases the device or process goes away anyway. Chaining each start on the previous one would also let a hung start block the next one, which is a new risk for a theoretical gain.

Closing per maintainer triage (low-risk / zero user trade-off / material-gain bar).

@OrcaWin OrcaWin closed this Oct 29, 2026
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