Skip to content

fix(emulator): retire scrcpy streams when video sockets close - #35518

Closed
OrcaWin wants to merge 1 commit into
mainfrom
audit/scrcpy-video-socket-retirement
Closed

OrcaWin wants to merge 1 commit into
mainfrom
audit/scrcpy-video-socket-retirement

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​78 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​78
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

LoC: +81/-2

Close scrcpy resources when the video connection ends. A partial handshake followed by EOF previously left startup pending, while a complete handshake followed by EOF left the helper/control socket active. Helper exit before the first byte also left an untracked socket open. Own the socket from creation and route post-byte EOF through existing failure/teardown, preserving pre-byte retries.

Validation:23 configured tests/3 suites,3 expected baseline regressions with8 controls,strict focused TypeScript and all5 normal hook tasks pass. Real Node26.8.1 sockets and owned helper children:12 groups per arm at1/10 streams. Baseline leavesNpending starts orNhelpers/control peers after video EOF andNpeers after predata helper exit;final0. Healthy startup,retry,explicit-close controls preserve outputs;all owned helpers/sockets/servers/profiles cleaned. Seven actual production modules,no module stubs;ADB command runner and real helper executable are controlled fixtures. No physicalAndroid/ADB,nativeElectronUI,macOS/Windows,CPU/RSS/latency claim.

Required aggregate queued after #35511; no aggregate pass or Claude takeover claimed. Eight source/caller blobs equal main78279250. Initial PID fixture failures and cleanup retained and excluded from successful comparisons. No process-launch,wire,retry/deadline or routing change. Preserve adjacent #35490/#35503/#35511 and #9950 changes on rebase.

Frozen head b7533d7b6abc4e9d265043f4d21b3a8bc02da61d, base 79dbada2c873bef3584a0c53b23ae98f2a84e536. Evidence /home/neil/.local/state/orca-electron-audit/scrcpy-video-socket-retirement/report.md;50-payload seal 7d8f75b151e51da783f064bb78c421261574270cc456dd5fa070302f73eaec05.

@OrcaWin

OrcaWin commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for this. I'm closing it because main already tears the stream down on each path it covers. When the scrcpy video socket drops, the server ends, the adb shell child exits, and server.on('exit') runs fail() or close(). onError and onClose both call scrcpyVideoRegistry.stop(serial), so tearing down earlier changes nothing users can see. The added lifecycle tests cover paths users don't hit.

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