Skip to content

test(android): port-collision give-up test races the fake emulator's exit against boot polling #210

Closed

Description

@ElbertePlinio

packages/android/test/emulator.test.ts > port collisions outside the reservation registry > gives up after the bounded retries and keeps the collision diagnosis failed once in CI with expected startEmulator to reject (run 36172915229 on #208, passed on rerun and 5/5 locally).

The fake emulator prints address already in use and exits 1, but the test pairs it with BOOTING_ADB_SCRIPT, which reports emulator-5554 as a booted device. If a boot poll (20 ms interval) sees sys.boot_completed=1 before the emulator's exit is observed, startEmulator resolves instead of reporting the collision.

  • Make the collision tests use an adb fake that never reports boot, or have startEmulator prefer an observed early exit over a concurrent boot signal
  • Confirm the test is stable under load (for example a nice'd loop)

Refs #208

Activity

  1. ElbertePlinio commented on Oct 3, 2026

    @ElbertePlinio
    MemberAuthor

    This failed again in CI on PR #221, which changes only the desktop zenity tests. It failed in the bun run test:coverage step of the test job (attempt 3 of run 37135747544), with "Error: expected startEmulator to reject" at packages/android/test/emulator.test.ts:400. The same commit passed attempts 1 and 2.

    Failed job: https://github.com/pickforge/pickforge/actions/runs/37135747544/job/111243035416

  2. ElbertePlinio commented on Oct 6, 2026

    @ElbertePlinio
    MemberAuthor

    More evidence from the #250 and #252 work. Under two concurrent full suites, "port collisions outside the reservation registry" failed with EADDRINUSE on the fixed port 127.0.0.1:5670. The "retries on a fresh port" test then failed with expected ['5672'] to deeply equal ['5670','5672']. "gives up after the bounded retries and keeps the collision diagnosis" also failed once in a full suite with "expected startEmulator to reject", and passed alone on the branch and on origin/main. A per-run free port would remove the cross-run collision.

  3. ElbertePlinio commented on Oct 7, 2026

    @ElbertePlinio
    MemberAuthor

    Re-checked after the host RTTIME fix from #253. Four rounds of two concurrent full suites on main be2d00c did not reproduce this, and no test process was SIGKILLed. The issue describes a timing assumption in the test code, so it stays open. A starved-CPU run, as in the original report, is still the way to confirm the fix.

  4. ElbertePlinio commented on Oct 7, 2026

    @ElbertePlinio
    MemberAuthor

    Seen again while fixing #280 (PR #289). In 15 rounds of two concurrent copies of emulator.test.ts with PR #289, the only failure was this give-up test (expected startEmulator to reject at the give-up case), 1 of 30 runs. PR #289 serializes the file across runs, so this failure comes from inside one run.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions