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
Released iOS simulator stays booted after simlock daemon stop #1056
After a lease was released and simlock daemon stop returned, the released iOS simulator kept running. No daemon owned it any more:
simlock lease --platform ios --device "iPhone 16" --detach # lse_632aaee9…, device 5F3D67F7…
simlock release lse_632aaee9-4590-47b8-8f52-915a062b901d # ok
simlock list # device state: reclaiming
simlock daemon stop # ok
xcrun simctl --set $SIMLOCK_HOME/devices/ios list devices
# simlock-a8e7126d-… (5F3D67F7-032F-4B35-9A26-A07C98A0A11B) (Booted)
pgrep -fl launchd_sim # launchd_sim for that device still running
The warm pool probably kept it (warmPool.enabled keeps released devices booted). But once the daemon stops, nothing manages the device, and it keeps using RAM until the next daemon start or a reboot.
What you expected
One of these:
daemon stop shuts down idle (unleased) devices it booted before it exits, or
the docs say clearly that idle warm devices stay booted after daemon stop, and how to shut them down. The daemon stop docs (website/src/content/docs/docs/reference/cli.mdx:357, worker/running-the-daemon.mdx:119) say nothing about it.
xcrun simctl --set $SIMLOCK_HOME/devices/ios list devices shows the device (Booted).
Found in an agent onboarding experiment (Haiku installing and setting up simlock from the docs). In that flow it leaves a booted simulator behind after the "prove it works, then clean up" step.
Maintainer decision: daemon stop shuts down the idle (unleased) devices this daemon booted before it exits. Warm devices are not kept across a daemon stop.
Gap: the expectation is the maintainer's decision on this thread, a proposal.
e2e/daemon-lifecycle.test.ts › "daemon stop shuts down every idle device it booted, one still reclaiming included, and leaves the leased one running" on bug/1056-repro. Two idle devices (one released right before the stop, still reclaiming), one leased; asserts the fake driver's shutdown calls.
Correction to the issue: the docs do cover this. website/src/content/docs/docs/worker/running-the-daemon.mdx:117 says "does not shut down devices … the next daemon picks them up".
Root cause
src/daemon/main.ts:706-710: the worker's settle waits for background reclaims (leasing.settle), so a device still reclaiming ends ready. Then core.drain() (src/core/warm-pool/converger.ts:295) closes the pool and waits for its passes. Neither step shuts down an idle ready device, and dispose does not either. No ADR requires keeping them booted (checked 0004, 0017, 0019, 0038, 0041).
Simplest fix
After drain settles, shut down every ready virtual device that has no lease and no claim, through the pool's existing #shutdown (lifecycle.shutdown, cleanup claim, a log line with reason daemon-stop). A throwaway version of that loop at the end of WarmPool.drain made the test pass. In the same change, update running-the-daemon.mdx:117 and the daemon stop row in reference/cli.mdx.
Alternatives rejected
Shut down in beginStop: it runs before reclaims settle, so the device that is still reclaiming would be missed.
Docs only: the maintainer decided otherwise.
Shut down every device: leases outlive daemon stop (ADR 0004 §3, src/daemon/AGENTS.md rules).
Risk
Shutdowns must finish before dispose, which stops Android's adb server.
The next start boots the learned kinds again (ADR 0038), so every restart now costs a boot.
The fake reclaim is fast: a fix reading a snapshot taken at stop could still pass. Check the order in code.
Maintainer confirmed the behaviour shipped in #1150: daemon stop (and simlock update) shuts down idle devices, so the next start boots the warm pool's devices again. Kept as is.
Activity
V3RON commentedon Oct 31, 2026
Maintainer decision:
daemon stopshuts down the idle (unleased) devices this daemon booted before it exits. Warm devices are not kept across a daemon stop.Written by an agent.
V3RON commentedon Oct 31, 2026
Reproduction
Gap: the expectation is the maintainer's decision on this thread, a proposal.
e2e/daemon-lifecycle.test.ts› "daemon stop shuts down every idle device it booted, one still reclaiming included, and leaves the leased one running" onbug/1056-repro. Two idle devices (one released right before the stop, still reclaiming), one leased; asserts the fake driver'sshutdowncalls.Correction to the issue: the docs do cover this.
website/src/content/docs/docs/worker/running-the-daemon.mdx:117says "does not shut down devices … the next daemon picks them up".Root cause
src/daemon/main.ts:706-710: the worker'ssettlewaits for background reclaims (leasing.settle), so a device stillreclaimingendsready. Thencore.drain()(src/core/warm-pool/converger.ts:295) closes the pool and waits for its passes. Neither step shuts down an idlereadydevice, anddisposedoes not either. No ADR requires keeping them booted (checked 0004, 0017, 0019, 0038, 0041).Simplest fix
After
drainsettles, shut down everyreadyvirtual device that has no lease and no claim, through the pool's existing#shutdown(lifecycle.shutdown,cleanupclaim, a log line with reasondaemon-stop). A throwaway version of that loop at the end ofWarmPool.drainmade the test pass. In the same change, updaterunning-the-daemon.mdx:117and thedaemon stoprow inreference/cli.mdx.Alternatives rejected
beginStop: it runs before reclaims settle, so the device that is still reclaiming would be missed.daemon stop(ADR 0004 §3,src/daemon/AGENTS.mdrules).Risk
dispose, which stops Android's adb server.Written by an agent.
docs(daemon): stopping the unit and a restart now shut down idle devi…
test(daemon): stop test waits on a slow reclaim; a failed idle shutdo…
test(e2e): usage projection keeps its device facts across a restart t…
V3RON commentedon Oct 31, 2026
Maintainer confirmed the behaviour shipped in #1150:
daemon stop(andsimlock update) shuts down idle devices, so the next start boots the warm pool's devices again. Kept as is.Written by an agent.
fix(daemon): daemon stop shuts down idle devices (callstackincubator#…