Skip to content

Skip the iOS simulator terminate right after boot and bound the others - #65

Merged
bitsandfoxes merged 4 commits into
fix/adb-hung-launchfrom
fix/ios-terminate-stall
Oct 29, 2026
Merged

bitsandfoxes merged 4 commits into
fix/adb-hung-launchfrom
fix/ios-terminate-stall

Conversation

@bitsandfoxes

@bitsandfoxes bitsandfoxes commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

The iOS simulator provider no longer runs simctl terminate before the first launch after it boots the simulator, and every other terminate is bounded to 60 s. The first launch no longer stalls for minutes.

In 150 sentry-unity Run iOS logs, the simctl terminate before the first launch stalled for 59–430 s in 24 legs (16%), for example 349 s here. Later terminates never took more than 14 s, even when the app wasn't running. A first attempt waited for simctl bootstatus before that terminate. In this run, bootstatus returned within 1 s on all four legs, yet the first terminate still hung in one of them until the 60 s cap. So the stall isn't a boot that hasn't finished, and waiting for one doesn't help.

How it works now:

  • Before the first launch after BootSimulator() actually booted the device, the provider skips the terminate. On a freshly booted simulator, the app can't be running. The flag resets on every boot, restart and disconnect. A simulator that was already booted when the provider connected still gets the terminate.
  • Every other simctl terminate is bounded to 60 s, including the one after a run timeout. If the terminate before a launch times out, the launch adds --terminate-running-process, so every launch still starts a fresh process.

Tests/iOSSimulatorRunApplication.Tests.ps1 runs on macOS only. It uses a fake xcrun and runs the real start, restart and disconnect paths. It covers the skip after a boot, the re-arm after a restart, an already-booted simulator, a hung terminate and its fallback, and killing a hung command.

Stacked on #64.

CI evidence: in sentry-unity run 40241909708 (getsentry/sentry-unity#2910, pinned to this commit), every Run iOS leg's first launch started 0 s after "Run log" and later launches within 1–5 s. No terminate timed out, and all 4 legs passed 57/57.

🤖 Generated with Claude Code

@bitsandfoxes
bitsandfoxes force-pushed the fix/ios-terminate-stall branch from 127a3f4 to 992e399 Compare October 25, 2026 22:48
@bitsandfoxes bitsandfoxes changed the title Wait for the iOS simulator boot before terminating the app, and bound terminate Skip the iOS simulator terminate right after boot and bound the others Oct 25, 2026
@bitsandfoxes
bitsandfoxes marked this pull request as ready for review October 29, 2026 10:58
@bitsandfoxes
bitsandfoxes requested review from a team, jpnurmi, limbonaut and tustanivsky October 29, 2026 10:59
BootSimulator cleared FreshlyBooted before simctl boot, so a second boot
of a simulator this provider just booted (Connect, then Start-Device)
hit the already-Booted early return with the flag lost, and the first
launch ran the simctl terminate the fresh-boot skip exists to avoid.
Clear it only once the boot command has run.
The test got there by having the fake boot throw 'Unable to boot device
in current state: Booted', but the real InvokeBuiltCommand throws an
exit-code message, so production reaches an already-booted simulator
through SelectAndConnect's booted branch. Connect by UUID to a simulator
the fake lists as Booted instead, so that branch is covered.
BootSimulator matched simctl's 'Unable to boot device in current state:
Booted' text, but InvokeBuiltCommand throws only 'Command (boot) failed
with exit code N', so a second boot of a simulator this provider booted
rethrew instead of keeping FreshlyBooted. Ask for the simulator state
when boot fails and rethrow the boot error unless it is Booted, and have
the test fake throw the exit-code message the real command throws.
@bitsandfoxes
bitsandfoxes merged commit fec553f into fix/adb-hung-launch Oct 29, 2026
6 checks passed
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.

3 participants