Skip to content

slow lane: gateway Android suite times out booting under load and leaves orphaned emulators #1102

Closed

Description

@V3RON

The slow lane's gateway Android suite (e2e/slow-agent-device-gateway.test.ts, "with the device limit raised to 2") fails in setup under heavy host load, and the lane leaves orphaned simlock emulators behind.

1. Boot timeout under load. warmUp (e2e/helpers/agent-device-targets.ts:154) gets lease code 1, INTERNAL: Timed out waiting for device to boot (etaMs 70000), then the 330 s warm-up times out. One earlier run instead timed out in setLimits (agent-device-targets.ts:144, "previous daemon process exited", 30 s). It fails the same way on main 795733b with agent-device 0.21.32 and on #1094 with 0.21.35, so the agent-device version is not the cause. The 15-min load was 120-274 during the runs (Spotlight and mediaanalysisd ~250% CPU).

2. Orphaned emulators. After the gateway Android suite, qemu-system-aarch64 -avd simlock_<id>, netsimd and crashpad_handler keep running with ppid 1. Seen after 3 runs (for example pid 19449, avd simlock_8dcea1d6, port 5586 on main). The next lane's start-of-run cleanup stops them, but they add to the load in the meantime.

#1077 (merged today) changed the daemon stop and teardown order; it may be related to (2) and the restart wait.

Logs (2026-10-30):

  • main, 0.21.32: /var/folders/tb/j39z273s5kn7lb9tz1dhk8l00000gn/T/simlock-slow-e2e-20261030-232348.log
  • chore(deps): bump @agent-device/proxy to 0.21.35 #1094, 0.21.35: /var/folders/tb/j39z273s5kn7lb9tz1dhk8l00000gn/T/simlock-slow-e2e-20261030-230356.log, -225042.log, -222307.log

Found while verifying #1094.

Written by an agent.

Activity

  1. added
    bug:new
    on Oct 30, 2026
  2. self-assigned this
    on Oct 31, 2026
  3. added a commit that references this issue on Oct 31, 2026
  4. V3RON commented on Oct 31, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Defect in the e2e harness. Part 1 is the host: Android boot has a fixed 180 s limit (src/drivers/android/index.ts:87) and the load was 120-274. Part 2: #1150 now shuts down ready devices at daemon stop, which covers passing runs, but not a leased device. warmUp leaves its warm-up leases held when a later one fails, which is the main run's path (warmup-2 timed out, warmup-1 stayed leased).

    e2e/helpers/agent-device-targets.test.ts, "when a later warm-up lease fails, rejects and leaves none of the warm-up leases it took held" (fake driver, branch bug/1102-repro):

    pnpm test:e2e e2e/helpers/agent-device-targets.test.ts
    AssertionError: expected [ { …(9) }, { …(9) } ] to deeply equal []
    + "requesterId": "warmup-1" ... "requesterId": "warmup-2"
     ❯ e2e/helpers/agent-device-targets.test.ts:29
    

    Root cause

    e2e/helpers/agent-device-targets.ts:154: the failing expect throws out of the lease loop, so the release loop at :157 never runs. Teardown (e2e/helpers/env.ts:479) runs daemon stop, which keeps leased devices running (ADR 0004 §3, kept by #1150), then deletes the home. It empties only the iOS device set (env.ts:501), so the held emulator runs on with ppid 1.

    Simplest fix

    Wrap the lease loop in try/finally and release the ids taken so far in the finally. The test passes with it locally.

    Alternatives rejected

    • Teardown runs release --all --yes before daemon stop: every teardown would also wait for reclaims, under the stop waits that already time out.
    • An Android twin of emptyDeviceSet in teardown: duplicates scripts/slow-e2e.sh clean.
    • A longer Android boot limit for part 1: hides an overloaded host.

    Risk

    • Proven with the fake driver only; no slow-lane run.
    • A daemon the harness SIGKILLs after a slow stop still leaves devices (the restart's 30 s wait, env.ts:401, timed out in 2 of 4 runs). fix(daemon): daemon stop shuts down idle devices (#1056) #1150 makes stop slower.
    • Part 1 remains: at this load the suite can still fail on the 180 s boot limit.

    Side findings

    Written by an agent.

  5. removed their assignment
    on Oct 31, 2026
  6. added
    bug:ready
    and removed
    bug:new
    on Oct 31, 2026
  7. self-assigned this
    on Oct 31, 2026
  8. V3RON commented on Oct 31, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1160 (#1102)
    Parked: none
    Waiting: none

    Written by an agent.

  9. added a commit that references this issue on Oct 31, 2026
    e23a14d
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