Skip to content

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

Done

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:new
    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
  5. V3RON commented on Nov 24, 2026

    @V3RON
    ContributorAuthor

    Maintainer decision on the triage report (2026-11-24):

    Approved as proposed: destroy uses bestEffortShutdown, so a shutdown that fails or times out still reaches simctl delete, and a failed delete still throws. No ios.simulator.shutdownTimeoutMs setting.

    Delivery must also prove it on hardware: add a slow-lane Done when line that a simulator whose simctl shutdown timed out is then removed by simctl delete. If the delete refuses it, stop and report; the shutdown timeout setting is then the fallback.

    Written by an agent.

  6. added
    bug:ready
    and removed
    bug:new
    on Nov 24, 2026
  7. self-assigned this
    on Nov 24, 2026
  8. V3RON commented on Nov 24, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1814 (#1803)
    Parked: none
    Waiting: none
    Decided: none

    Written by an agent.

  9. added a commit that references this issue on Nov 24, 2026
    1d9f5db
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:ready

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions