You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android emulator-console calls emu kill, snapshot save and snapshot list have no deadline #1138
Same shape as #1047, on other paths: these adb -s <serial> emu ... calls go through #processRunner.run / #runOrThrow with no timeoutMs, and NodeProcessRunner sets none by default (src/ports/process-runner.ts:203). An emulator whose console stops answering holds the call, and the device lock with it, without limit (architecture rule 11).
src/drivers/android/index.ts:1217 emu kill (#stopUnownedEmulator)
src/drivers/android/index.ts:2222 emu avd snapshot save (#captureBaseline, during makeReady)
src/drivers/android/index.ts:2231 emu avd snapshot list (#captureBaseline)
src/drivers/android/index.ts:2272 emu kill (#shutdown, also the fallback #1047 proposes)
Line numbers at ce8fea8. Found while triaging #1047.
Defect, confirmed for three of the four calls. The #stopUnownedEmulator kill (line 1215 on 6557335) already has timeoutMs: 5_000, asserted by "stops a discovered running emulator before deleting its AVD after a restart".
Branch bug/1138-repro, src/drivers/android/index.test.ts: "ends a first boot whose emulator console never answers $call: the hung adb call is stopped and makeReady fails" (save, list) / "...and the boot still completes" (kill). Each case hangs one call in the first makeReady and moves the driver clock ten minutes.
Its ClockDeadlineRunner applies run's timeoutMs on the fake clock, so both fix shapes below pass.
Root cause
src/drivers/android/index.ts:2225 (snapshot save) and :2234 (snapshot list) in #captureBaseline call #runOrThrow, and :2275 (emu kill) in #shutdown calls run, all without timeoutMs. NodeProcessRunner.run arms no timer then (src/ports/process-runner.ts:203), so a silent console holds the call, and #withDeviceLock, forever (architecture rule 11). Core shows a device stuck in preparing, reclaiming or destroying; #shutdown is on every stop path.
Simplest fix
Pass timeoutMs on the three calls, as lines 1215 and 2078 do: 60 s for save, 5 s (OWNERSHIP_PROBE_TIMEOUT_MS) for list and kill. A scratch version passed the whole file. A timed-out save or list throws the same DriverCrashError as a failed one; a timed-out kill falls through to the existing wait-then-SIGKILL.
Activity
test: reproduce #1138 — a first boot hangs on an emulator console tha…
V3RON commentedon Oct 31, 2026
Reproduction
Defect, confirmed for three of the four calls. The
#stopUnownedEmulatorkill (line 1215 on 6557335) already hastimeoutMs: 5_000, asserted by "stops a discovered running emulator before deleting its AVD after a restart".Branch
bug/1138-repro,src/drivers/android/index.test.ts: "ends a first boot whose emulator console never answers $call: the hung adb call is stopped and makeReady fails" (save, list) / "...and the boot still completes" (kill). Each case hangs one call in the firstmakeReadyand moves the driver clock ten minutes.Its
ClockDeadlineRunnerappliesrun'stimeoutMson the fake clock, so both fix shapes below pass.Root cause
src/drivers/android/index.ts:2225(snapshot save) and:2234(snapshot list) in#captureBaselinecall#runOrThrow, and:2275(emu kill) in#shutdowncallsrun, all withouttimeoutMs.NodeProcessRunner.runarms no timer then (src/ports/process-runner.ts:203), so a silent console holds the call, and#withDeviceLock, forever (architecture rule 11). Core shows a device stuck inpreparing,reclaimingordestroying;#shutdownis on every stop path.Simplest fix
Pass
timeoutMson the three calls, as lines 1215 and 2078 do: 60 s forsave, 5 s (OWNERSHIP_PROBE_TIMEOUT_MS) forlistandkill. A scratch version passed the whole file. A timed-out save or list throws the sameDriverCrashErroras a failed one; a timed-out kill falls through to the existing wait-then-SIGKILL.Alternatives rejected
#waitForExiton the driver clock (fix(android): bound the clean-baseline snapshot load at 60 s #1149's shape): more code, needed only when a timeout takes its own branch.timeoutMsinNodeProcessRunner: every caller inherits a budget it never chose.Risk
snapshot savewith a largehw.ramSizeon a busy host.#shutdownstill waits up toreadinessTimeoutMs(180 s) beforeSIGKILL: bounded, but the lock is held that long.Written by an agent.
V3RON commentedon Oct 31, 2026
Delivery run
Merged: #1159 (#1138)
Parked: none
Waiting: none
Written by an agent.
fix(android): give emulator console snapshot save, snapshot list and …