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
Android: only one emulator per worker joins Wi-Fi (shared netsim, same snapshot) #1586
When a worker runs more than one Android emulator, only one of them joins Wi-Fi. The others report Wifi is not connected and reach the network only over the emulated mobile data link (eth0).
Seen on a simlock 0.6.0 worker (macOS 15.7.4 arm64, emulator 37.2.13) with four emulators booted:
Emulator
cmd wifi status
wlan0 IPv4
emulator-5586
connected to "AndroidWifi"
10.0.2.16/24
emulator-5588
not connected
none
emulator-5590
not connected
none
emulator-5592
not connected
none
All four were started from the same AVD and snapshot (qemu-system-aarch64-headless -avd simlock ... -snapshot simlock_boot), and a single netsimd serves every instance on the host.
Why it matters
Which device gets Wi-Fi depends on boot order, so it changes from lease to lease. A test that checks the connection type (for example NetInfo type === 'wifi'), or app logic that only works on Wi-Fi, passes or fails depending on which emulator it was leased. Consumers currently work around it by forcing every device onto mobile data.
Suspected cause (not verified)
Every instance restores the same snapshot, so all of them likely come up with the same Wi-Fi MAC address. They all share one netsim radio, so the instances collide and only one association succeeds. I couldn't read the MAC from the guest without root to confirm this.
Possible fixes
Give each emulator its own netsim instance (-netsim-args / netsimd --instance <n>, keyed off the console port), or
give each emulator a unique Wi-Fi MAC at launch or after a snapshot restore.
Expected result: every leased emulator has its own working Wi-Fi.
Done: reproduction pushed to bug/1586-repro: e2e/slow-android-wifi.test.ts, "two Pixel 9 leases held at once both report Wi-Fi connected with an IPv4 address on wlan0". Not run: only real emulators show it.
Not done: the failing run, root cause confirmation, fix trial, report.
Findings: simlock passes nothing per copy for Wi-Fi (src/drivers/android/emulator.ts:257); every copy boots -snapshot simlock_boot (index.ts:632). The emulator sets a unique Wi-Fi MAC at cold boot from a kernel mac_prefix; a snapshot load keeps the seed's. Since 36.5 all instances share one Wi-Fi network, so equal MACs collide. Candidate fixes, untested:
emulator -help: -wifi-mac-address <mac> "only applies ... loaded from snapshot using read-only mode"
-feature -WiFiPacketStream old per-instance router (developer.android.com, emulator-networking-interconnect)
-netsim-args "--instance <n>" one netsimd per emulator
Blocked on: a slow-lane run of e2e/slow-android-wifi.test.ts.
e2e/slow-android-wifi.test.ts on bug/1586-repro, "two Pixel 9 leases held at once both reach the Wi-Fi gateway over wlan0". It now pings 10.0.2.2 over wlan0: right after a snapshot load every copy still reports "connected", with the seed's address.
Defect. A cold boot sets the Wi-Fi MAC from the console port (5654 → 02:16:16:00:00:00); a snapshot load keeps the seed's. Every copy boots -snapshot simlock_boot (src/drivers/android/index.ts:632) with no per-copy Wi-Fi flag (src/drivers/android/emulator.ts:364). So copies share one MAC and IP on the one netsim Wi-Fi network the host's emulators have shared since emulator 36.5, and at most one of them stays associated.
Simplest fix
Add -feature -WiFiPacketStream to emulatorLaunchFlags, so each emulator has its own Wi-Fi router, and add it to seedLaunchInputs (index.ts:902), so older seeds go stale and are remade under it. Tried: the reproduction passed (248 s, seed remake included).
Copies working, 3 booted at once, by hand:
no change 4/12
-feature -WiFiPacketStream 12/12 (seed without the flag: Wi-Fi ~55 s after ready)
same, seed made with it 6/6 (Wi-Fi within 9 s; ready in 5–6 s, as today)
Alternatives rejected
Port-derived -wifi-mac-address (± -read-only): 8/12 and 10/12; copies keep the snapshot's IP.
-netsim-args --instance <n>: the emulator can't reach its netsimd; hangs or segfaults.
One netsimd per copy via -packet-streamer-endpoint: 12/12, but simlock would run and reap a netsimd per device.
Risk
Emulators on one worker no longer share Wi-Fi with each other; traffic through the host (10.0.2.2, tunnels) is unchanged.
Untested on Linux/Windows and other images; a future emulator may drop the feature.
Every existing seed is remade once.
Fast track
Defect: yes
Fix tried: no — 83 unit tests whose fakes pin the emulator command line need the new flag
Nothing public added or broken: yes
No ADR or rule changed: yes
One fix: no — a shared-network fix would keep emulator-to-emulator Wi-Fi
Merged: #1764 (#1586)
Decided: #1586 — should saved Android baselines go stale when the Wi-Fi flag is added? → no: only seeds are remade; a copy of a baseline saved before the change joins Wi-Fi about a minute after it is ready (#1764 (comment))
Activity
V3RON commentedon Nov 18, 2026
Handoff
Done: reproduction pushed to
bug/1586-repro:e2e/slow-android-wifi.test.ts, "two Pixel 9 leases held at once both report Wi-Fi connected with an IPv4 address on wlan0". Not run: only real emulators show it.Not done: the failing run, root cause confirmation, fix trial, report.
Findings: simlock passes nothing per copy for Wi-Fi (
src/drivers/android/emulator.ts:257); every copy boots-snapshot simlock_boot(index.ts:632). The emulator sets a unique Wi-Fi MAC at cold boot from a kernelmac_prefix; a snapshot load keeps the seed's. Since 36.5 all instances share one Wi-Fi network, so equal MACs collide. Candidate fixes, untested:Blocked on: a slow-lane run of
e2e/slow-android-wifi.test.ts.Written by an agent.
test: reproduce #1586 — two leases held at once both reach the Wi-Fi …
V3RON commentedon Nov 19, 2026
Reproduction
e2e/slow-android-wifi.test.tsonbug/1586-repro, "two Pixel 9 leases held at once both reach the Wi-Fi gateway over wlan0". It now pings10.0.2.2over wlan0: right after a snapshot load every copy still reports "connected", with the seed's address.Root cause
Defect. A cold boot sets the Wi-Fi MAC from the console port (5654 →
02:16:16:00:00:00); a snapshot load keeps the seed's. Every copy boots-snapshot simlock_boot(src/drivers/android/index.ts:632) with no per-copy Wi-Fi flag (src/drivers/android/emulator.ts:364). So copies share one MAC and IP on the one netsim Wi-Fi network the host's emulators have shared since emulator 36.5, and at most one of them stays associated.Simplest fix
Add
-feature -WiFiPacketStreamtoemulatorLaunchFlags, so each emulator has its own Wi-Fi router, and add it toseedLaunchInputs(index.ts:902), so older seeds go stale and are remade under it. Tried: the reproduction passed (248 s, seed remake included).Copies working, 3 booted at once, by hand:
Alternatives rejected
-wifi-mac-address(±-read-only): 8/12 and 10/12; copies keep the snapshot's IP.-netsim-args --instance <n>: the emulator can't reach its netsimd; hangs or segfaults.-packet-streamer-endpoint: 12/12, but simlock would run and reap a netsimd per device.Risk
10.0.2.2, tunnels) is unchanged.Fast track
Written by an agent.
test(android): a seed made before the per-emulator Wi-Fi flag is stale (
fix(android): the Wi-Fi flag is in a seed's launch-settings hash only…
test(android): a seed made under the current launch settings reads cu…
test(daemon): the discovered Android driver's launch carries the per-…
V3RON commentedon Nov 19, 2026
Delivery run
Merged: #1764 (#1586)
Decided: #1586 — should saved Android baselines go stale when the Wi-Fi flag is added? → no: only seeds are remade; a copy of a baseline saved before the change joins Wi-Fi about a minute after it is ready (#1764 (comment))
Written by an agent.
fix(android): every emulator gets its own Wi-Fi router (callstackincu…