Repository navigation
Description
Summary
On Android, simlock saves the seed's simlock_boot snapshot before the emulated cellular data call is up, and readiness never checks the network. Every lease restored from that snapshot starts with no network. On our host, 13 of 13 google_atd leases had no route when simlock lease returned. They came online 16 to 58 s later.
Related: #1586 (the same idea for Wi-Fi: per-device network state frozen in the shared snapshot).
Environment
- simlock 0.7.0, emulator 37.2.13, platform-tools 37.0.1, Linux x64 (WSL2), headless.
--platform android --device "Pixel 9" --os 36 --image-tag google_atd --mode full, warm pool off.- Default slirp networking. No
-netdelay,-netspeedor-net-tap.
What happens
dist/drivers/android/seeds.js:491-496(#bootToSnapshot) starts the seed with-no-snapshot-load, waits for readiness, and calls#saveBootSnapshotat once.dist/drivers/android/seeds.js:517-520(#saveBootSnapshot) runsadb emu avd snapshot save simlock_boot.- Readiness is
dist/drivers/android/emulator.js:128-171(waitForReadiness,#bootSettled). It checkssys.boot_completed,init.svc.bootanimandpm path android. It does not check connectivity. - In the seed's boot log, the save came 1.7 s after
sys.boot_completed. The SIM had just reported READY, the radio was not in service, and noSETUP_DATA_CALLhad been sent. - After a lease restores the snapshot, telephony resumes. Data stays disallowed (
SIM_NOT_READY DATA_CONFIG_NOT_READY NO_SUITABLE_DATA_PROFILE NOT_IN_SERVICE DEFAULT_DATA_UNSELECTED) until SIM records and carrier config load. ThenSETUP_DATA_CALLis sent,eth0comes up with10.0.2.15/24, andConnectivityServicereports validation passed.
Until then, the guest has:
eth0state DOWN, with no address;- no
oif eth0rules inip rule, so lookups fall through to32000: from all unreachable; dumpsys connectivity:Active default network: none;connect: Network is unreachablefor any host,10.0.2.2included, and failing DNS.
Tests that start right after the lease see sign-in and CAPTCHA failures and EHOSTUNREACH.
Per-lease measurements
One lease at a time, same seed each time.
| lease | network at lease return | online after | host load1 |
|---|---|---|---|
| c1 | down | about 35 s | 8 |
| c2 | down | about 35 s | 17 |
| c3 | down | 30 s | 14 |
| c4 | down | 55 s | 14 |
| c5 | down | 51 s | 30 |
| c6 | down | 16 s | 39 |
| c7 | down | 40 s | 44 |
| c8 | down | 37 s | 63 |
| c9 | down | 24 s | 53 |
| c10 | down | 58 s | 49 |
| i1 | down | 41 s | 53 |
| i2 | down | 51 s | 73 |
| i3 | down | 30 s | 48 |
Down at lease return: 13 of 13. Still down 60 s after lease: 0 of 13. Recovery time does not track host load. c1 and c2 were polled every 10 s, so their times are approximate.
Proposed fix
Either of these would close it:
- In
#bootToSnapshot, wait for a validated default network before#saveBootSnapshot. For example, polldumpsys connectivityuntil the active default network hasVALIDATED, with a bound. The snapshot then holds a guest whose data call is already up. - Add the same network check to readiness, so a lease is not granted until its guest is online. This also covers a restored guest that has to redo the data call.
Option 1 removes the delay for every lease. Option 2 is a safety net for images whose network state does not survive a restore.
Workaround
We now wait in our e2e harness after each lease, for up to 120 s, for a validated default network that reaches our backend host.
Activity
V3RON commentedon Nov 19, 2026
Reproduction
Gap, not a defect: readiness never promised a network, and nothing waits for one before the save. The test's expectation is a proposal. Branch
bug/1631-repro,src/drivers/android/seeds-copies.test.ts, "saves a seed's boot snapshot only once the guest reports a default network". The fake guest reportsActive default network: nonetwice, then100.Confirms the report. The source lines are
src/drivers/android/seeds.ts:631-640andemulator.ts:194-249, notdist/.Root cause
src/drivers/android/seeds.ts:637:#bootToSnapshotcalls#saveBootSnapshotas soon asemulator.startreturns.startreturns oncewaitForReadinesspasses (emulator.ts:194), and that checks onlysys.boot_completed,init.svc.bootanim, the AVD path andpm path android(emulator.ts:228-249). So the snapshot every copy resumes holds a guest whose data call is not up yet. The leases are only where the symptom shows.Simplest fix
In
#bootToSnapshot, before the save, polladb -s <serial> shell dumpsys connectivityevery 1 s until it matches^Active default network: \d+. Bound the wait at 120 s, and past the bound save anyway, as today. The test fakes (test-seed-harness.ts,test-emulator-host.ts,two-instances.test.ts) answer the probe with a network.Alternatives rejected
VALIDATED: validation needs the host's internet, so an offline host would always wait out the bound.Risk
-WiFiPacketStreamchange did.dumpsys connectivitylines are not recorded from a real emulator. Record a fixture.Fast track
Written by an agent.
V3RON commentedon Nov 19, 2026
Folded into #1748 (Android settle of #1732). We won't fix it separately.
The settle replaces a kind's quick seed with a snapshot saved from an idle copy, and #1748 now requires that copy to have a default network before the save. Measured on this Mac (Android 36
google_apis, emulator 37.2.13):Active default network: none. Restored, it came online about 5–6 s after ready, here through Wi-Fi.Active default network: 100and a ping to 8.8.8.8 both answered at ready, 2.0 s after launch.adb logcat -T 1 -m 1 -e 'CONNECTED broadcast.*isDefaultNetwork=true' ConnectivityService:D '*:S'exits within about 0.7 s of ConnectivityService picking a default network.-ematches the message only, so the tag goes in the filter spec. A netlinkip -o monitor route | grep -m1 '^default'also fires, but it sees a route, not Android's choice of default network.What stays as it is: the first leases of a kind, which copy the quick seed before its settle; a worker that is never quiet; and Android baselines. The triage's repro test is on branch
bug/1631-repro.Written by an agent.
test(e2e): a settled Android seed's lease has a default network; the …
feat(android): a quick seed is replaced by its settled copy, and copi…