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
iOS: destroy stops at a timed-out simctl shutdown, so quarantine never reaches simctl delete #1803
A simulator whose simctl shutdown keeps running past 30 s is never deleted at lease end, in quarantine or at give-up, because the iOS destroy stops at the shutdown.
src/drivers/ios/index.ts:449-452: destroy runs shutdown and then simctl delete. A shutdown that times out throws before delete is tried.
src/core/quarantine-coordinator.ts:313 (each retry) and :367 (give-up) both call that destroy. On a host where the shutdown keeps timing out (memory pressure, swap ~2.5 GB in Orphan iOS devices stay on disk after a failed shutdown; cleanup doesn't see them #1801), each attempt spends 30 s on the shutdown and none reaches the delete. The device ends device.quarantine-stranded, keeping its capacity slot and its disk until an operator acts.
The record is kept, so this leaves no orphan. #1801 showed the log lines but not this end state.
Open question for the fix, to settle on a real simulator: does simctl delete remove a simulator whose shutdown has not finished? If it does, destroy can go on to the delete after a timed-out shutdown. If not, the shutdown needs a setting like createTimeoutMs.
Defect, confirmed as reported. src/drivers/ios/index-save-source-lifecycle.test.ts, "destroy still runs simctl delete after a simctl shutdown that times out, and succeeds when the delete does". Branch bug/1803-repro.
pnpm exec vitest run --project unit src/drivers/ios/index-save-source-lifecycle.test.ts -t "times out"
AssertionError: expected 'simctl shutdown 00000000-0000-0000-00…' to be 'deleted'
Received: "simctl shutdown 00000000-0000-0000-0000-000000000001 timed out after 30000ms"
❯ src/drivers/ios/index-save-source-lifecycle.test.ts:533:29
Root cause
src/drivers/ios/index.ts:451: destroy awaits Simctl.shutdown, which throws DriverCrashError at its fixed 30 s limit (src/drivers/ios/simctl.ts:64-67). The throw skips simctl delete on line 452. The symptom shows in src/core/quarantine-coordinator.ts:313 (retry) and :367 (give-up): every try fails the same way, so the device ends device.quarantine-stranded.
Simplest fix
In destroy, call this.#simctl.bestEffortShutdown(data.udid) instead of shutdown, and widen the why: comment on bestEffortShutdown (simctl.ts:77) to say a destroy lets simctl delete decide. A failed delete still throws, so quarantine behaves as today when the simulator cannot be deleted.
# fix applied, then git restore
pnpm exec vitest run --project unit src/drivers/ios/ src/core/quarantine-coordinator*.test.ts src/core/reclaim*.test.ts
Test Files 38 passed (38)
Tests 853 passed | 1 skipped (854)
Alternatives rejected
A ios.simulator.shutdownTimeoutMs setting: adds a config key, and a host that is stuck stays stuck at any limit.
Catch only the timeout and rethrow other shutdown failures: more code for a case the delete settles anyway.
Risk
Not checked on a real simulator: whether simctl delete removes one whose shutdown was killed mid-way. If it refuses, the device still strands, now with delete's error.
A destroy can now take up to 60 s (shutdown limit plus delete limit).
Fast track
Defect: yes
Fix tried: yes
Nothing public added or broken: yes
No ADR or rule changed: yes
One fix: no — a shutdown timeout setting is the other fix if simctl delete refuses a mid-shutdown simulator, unchecked on hardware
Activity
V3RON commentedon Nov 22, 2026
Reproduction
Defect, confirmed as reported.
src/drivers/ios/index-save-source-lifecycle.test.ts, "destroy still runs simctl delete after a simctl shutdown that times out, and succeeds when the delete does". Branchbug/1803-repro.Root cause
src/drivers/ios/index.ts:451:destroyawaitsSimctl.shutdown, which throwsDriverCrashErrorat its fixed 30 s limit (src/drivers/ios/simctl.ts:64-67). The throw skipssimctl deleteon line 452. The symptom shows insrc/core/quarantine-coordinator.ts:313(retry) and:367(give-up): every try fails the same way, so the device endsdevice.quarantine-stranded.Simplest fix
In
destroy, callthis.#simctl.bestEffortShutdown(data.udid)instead ofshutdown, and widen thewhy:comment onbestEffortShutdown(simctl.ts:77) to say a destroy letssimctl deletedecide. A failed delete still throws, so quarantine behaves as today when the simulator cannot be deleted.Alternatives rejected
ios.simulator.shutdownTimeoutMssetting: adds a config key, and a host that is stuck stays stuck at any limit.Risk
simctl deleteremoves one whose shutdown was killed mid-way. If it refuses, the device still strands, now with delete's error.Fast track
simctl deleterefuses a mid-shutdown simulator, unchecked on hardwareWritten by an agent.