Skip to content

Android emulator's adb transport drops briefly while Maestro drives a leased device (macOS arm64) #1162

Closed as not planned

Description

@prom3theu5

Summary

While Maestro drives a leased Android emulator, the device goes offline or not found on Simlock's adb server for about a second, then comes back. The emulator doesn't restart and the lease survives, but adb reverse rules are lost and Maestro exits with no assertion. We don't know the cause, and it may not be Simlock: Maestro and a relay of ours are also involved (see "A relay is in the path"). iOS flows on the same Mac run without trouble through the same tooling, but iOS has no adb transport, so that only rules out the Mac and the flows in general.

Environment

  • Simlock 0.4.0, worker and gateway on one Mac, under launchd
  • macOS 26.6.2, Apple M1 Max (arm64), 32 GB
  • Node 24.18.0
  • Android emulator 37.2.13.0, adb 1.0.41 (37.0.1), arm64-v8a Android 36 image, Pixel 9
  • Maestro 2.10.0
  • android.emulator.headless: true, gpu: auto, warm pool off
  • Leases taken through a Simlock client (T3 Code's device tools), with Maestro run separately on the Mac

What we see

  • simlock adb and Maestro report device offline or device '<serial>' not found.
  • host:track-devices shows the serial leave and come back within about a second.
  • Reverse rules are gone afterwards. Maestro stops with a stack trace and no failed step.
  • In one drop we looked at closely, adbd logged connection terminated: write failed, and its host-N counter showed many earlier reconnects. adbd hadn't restarted, which suggests the host side of the transport closed. We didn't establish who closed it.
  • A logcat reader opened 20 ms before that drop. We saw this once and didn't check other drops.
  • Simlock's daemon log was silent around the drops we checked.

Numbers

All counts are in time order and not randomised, so treat them as rough.

Condition Result
Earlier route, one emulator, Maestro restarting for every step, no viewer 13 runs passed, 34 killed by a drop
Same, with a screen stream up 0 passed, 7 killed
Screen stream alone, screen kept busy, no Maestro (25 cycles) 0 drops seen
30 plain simlock adb calls alone 0 drops
Short Maestro flows, one lease, several batches From 0 of 24 to nearly every run, varying by batch
Fewer Maestro restarts, two leased Pixels 3 drops in 30 Maestro starts, all on the second lease

Of the last three drops, two came about 1 second after Maestro started and one about 31 seconds into a flow.

What we've tried

  • Not lease age: drops happened on leases minutes old and an hour old.
  • A viewer isn't required: drops happen with no capture running. Whether a stream makes them more likely is unproved.
  • Not adb reverse calls: a batch that made none still dropped.
  • Not a plain adb server on 5037: drops continued after we stopped it.

A relay is in the path

Maestro lists Android devices at start-up on any platform, by asking the adb server on 5037. That server can't see Simlock's emulators, so Maestro then scans ports itself and blocks for ever on the emulator's console port. ANDROID_ADB_SERVER_PORT didn't help. iOS runs hang the same way while any emulator is up.

So each run starts a small relay from [::1]:5037 to Simlock's server on 5038, and starts Maestro with -Djava.net.preferIPv6Addresses=true. It forwards bytes and doesn't touch the emulator, but every Android Maestro run has gone through it, so we can't rule it out. An early version also cut any adb stream quiet for 3 seconds. Drops continued after we fixed that.

Questions

  1. Is there a supported way for Maestro to use a leased emulator, without a relay? Other tools get environment from a grant, and we didn't find what Maestro needs there.
  2. Is it expected that anything on the transport can drop a lease's connection this way? Does the adb server on 5038 ever reset transports by itself, for example on a health check or a lease renewal? One drop fell in the same second as lease.renewed and another 2 seconds after one, but a third matched none, so this is weak.
  3. What would help you diagnose it? We can run adb with ADB_TRACE, for example, if you tell us where.

Separately: emulator crashes

The same day we had three qemu-system-aarch64-headless crash reports. Two were hvf_map_safe in a qemu_abort, and one was in gfxstream's context clean-up. We haven't linked them to the drops. One ended a lease as device-lost about 10 minutes after the crash. We have the .ips files if useful.

Activity

  1. added
    bug:new
    on Nov 1, 2026
  2. self-assigned this
    on Nov 1, 2026
  3. V3RON commented on Nov 1, 2026

    @V3RON
    Contributor

    Not reproduced. No Simlock code path drops a lease's transport, so a fast test has nothing to fail on, and the slow lane cannot run Maestro or your relay.

    What was checked:

    lease.renewed            no driver call
    health probe, every 30 s adb devices; adb -s <serial> shell getprop ro.boot.qemu.avd_name + mark;
                             adb -s <serial> emu avd path (console port). None kicks a transport.
    host:emulator:<port>     sent only at daemon start and during boot/reclaim; adb returns early
                             for an attached port (connect_emulator_arbitrary_ports)
    emulator AdbGuestPipe    serves several host connections at once: a second client on the
                             adb port (e.g. dadb's direct scan of 5555-5683) does not close the first
    adb server               what gives exactly this symptom (serial leaves, emulator re-announces
                             within ~1 s, adbd stays up, reverse rules gone): host:disconnect:
                             (all emulators), reconnect (one), or a closed/errored emulator socket
    

    Your questions:

    1. No supported way today. The lease environment is ANDROID_ADB_SERVER_PORT, which dadb ignores (5037 is hard-coded).
    2. No. Renewal does not touch the driver, and the probe sends nothing that resets a transport.
    3. ADB_TRACE on Simlock's server goes nowhere today: its output is discarded (Simlock discards its adb server's output, so a transport drop leaves no record #1169).

    What would let us reproduce it:

    • Your relay's log of every client-to-server host request (the service string after the 4-hex length), timestamped, across a drop. A host:disconnect: or reconnect there names the trigger; simlock adb disconnect passes through today (simlock adb disconnect drops every leased emulator on Simlock's adb server #1168).
    • With two leases up: did track-devices show both serials leave, or only one? disconnect drops both; reconnect or a socket error drops one.

    Written by an agent.

  4. added
    bug:needs-info
    and removed
    bug:new
    on Nov 1, 2026
  5. removed their assignment
    on Nov 1, 2026
  6. github-actions commented on Nov 16, 2026

    @github-actions
    Contributor

    Closing: no reply in two weeks. Comment with the missing information and it reopens for triage.

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

    bug:needs-info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions