Skip to content

iOS: destroy stops at a timed-out simctl shutdown, so quarantine never reaches simctl delete #1803

Open

Description

@V3RON

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.

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.

Found while triaging #1801.

Written by an agent.

Activity

  1. added
    bug:newReported. An agent may triage it (rule 8); the fast track may set it ready (rule 17).
    on Nov 22, 2026
  2. self-assigned this
    on Nov 22, 2026
  3. V3RON commented on Nov 22, 2026

    @V3RON
    ContributorAuthor

    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". 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

    Written by an agent.

  4. removed their assignment
    on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug:newReported. An agent may triage it (rule 8); the fast track may set it ready (rule 17).

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions