Repository navigation
Description
What happened
After Simlock created another emulator, the existing emulator's next reclaim took the wipe path instead of loading its clean baseline, and its next lease took 61-76 s instead of seconds (on our build with local patches, where that rebuild also re-runs a setup program of ours). avdmanager (create avd, and also list avd) adds a hw.device.hash2=... line to the config.ini of every AVD in the home that lacks one. Simlock's AVDs lack one: for a library profile (the default Pixel 9 is one), #applyLibraryProfile replaces the seed device's hw. lines with the profile's, which leave hw.device.hash2 out. Simlock's config hash reads every hw. line of config.ini (#avdConfig, src/drivers/android/index.ts line 1880 on main at 7ac7f18), so that new line changes the hash of each existing AVD, which then no longer matches the hash stored with its baseline, and the reclaim wipes and rebuilds it.
What you expected
Creating a device leaves the other devices' clean baselines valid: a key that avdmanager adds and that changes nothing about the emulator's hardware is not part of the hash.
How to reproduce
simlock daemon startwithlease.identity.androidatreusableand room for two emulatorssimlock lease --platform android(device A), release it, wait for the reclaim- Lease A again, then from a second shell with a different
SIMLOCK_AGENT_ID(one lease per requester by default) runsimlock lease --platform android, so Simlock creates device B - Release A:
simlock eventsshows its reclaim withstrategy: wipe, andconfig.iniof A now has ahw.device.hash2line it did not have before step 3.
Seen in one run of ours.
Environment
Simlock 0.3.0 at commit 6316e10 (the Android driver is unchanged on main at 7ac7f18), Android only. macOS 27.0.1 on an M5 Max (128 GB), Android emulator 37.2.12, platform-tools 37.0.1, cmdline-tools 22.0 (avdmanager), image system-images;android-37.0;google_apis;arm64-v8a, default Pixel 9 profile. Seen on a build with our local patches; the hash code and avdmanager behaviour involved are unchanged from 6316e10. simlock doctor output was not captured at the time.
Logs and evidence
device.reclaimed events with strategy: wipe for the older device right after the new one was created, and its next lease at 61-76 s on our patched build. The older AVD's config.ini had gained a hw.device.hash2 line, and Simlock's config hash includes every hw. line. We have a tested change that leaves hw.device.hash2 out of the hash (other hw.device.* keys still count), as src/drivers/android/profiles/library.test.ts:35 already leaves it out of the library profiles' hardware keys; happy to open it as a PR if you want it.
Activity
V3RON commentedon Oct 31, 2026
Reproduction
Defect, confirmed as reported. Test on
bug/1048-repro(e57ebd1),src/drivers/android/index.test.ts: "restores the clean baseline on a standard reclaim after a hw.device.hash2 line is added to config.ini". It captures a baseline, appends the lineavdmanageradds, and reclaims.The
emu killis the stale-hash branch ofreclaim(index.ts:1124), which returnsshutdown/wipe.Root cause
src/drivers/android/index.ts:1899(#avdConfig) hashes everyhw.line ofconfig.ini,hw.device.hash2included. The emulator ignores that key: it is not in the emulator's list of hardware properties (checked on this host, emulator 36.5.11). So the hash changes even though the snapshot would still load. A library profile drops the seed'shw.device.hash2(isSeedHardwareLine,index.ts:2685, used atindex.ts:1506). The nextavdmanager create avdorlist avdwrites the line back into each such AVD. After that,reclaim(:1124) andmakeReady(#baselineVerdict) see a stale hash and wipe the device.Simplest fix
In
#avdConfig, leave out lines starting withhw.device.hash2=. Otherhw.device.*keys still count. With this change the whole file passes (300 passed).Alternatives rejected
hw.device.hash2in#applyLibraryProfile: it would hash the seed device, not the profile. It also leaves the hash open to the next keyavdmanageradds.Risk
config.inialready hashw.device.hash2(SDK and devices.xml profiles get it at create), the hash changes once, so each one wipes once after the upgrade. The pinned hash in "keeps a clean baseline captured before android.emulator existed" won't catch this, because its fixture has nohash2line.Written by an agent.
V3RON commentedon Oct 31, 2026
Decision
Upgrade behaviour: an AVD whose
config.inialready holdshw.device.hash2(SDK and devices.xml profiles) gets a new config hash once after the upgrade, so its next reclaim wipes and rebuilds its clean baseline once. Accepted: no hash-version migration. Pinned by the existing hash tests and "restores the clean baseline on a standard reclaim after a hw.device.hash2 line is added to config.ini". (decided in delivery, pending the maintainer)Written by an agent.
docs(android): manual states hw.device.hash2 is outside configHash (#…
V3RON commentedon Oct 31, 2026
Maintainer confirmed the decision above: the one-time wipe after the upgrade is accepted, with no hash-version migration. The fix shipped in #1147.
Written by an agent.
fix(android): leave hw.device.hash2 out of the config hash (callstack…
V3RON commentedon Nov 2, 2026
Follow-up: #327 (Named baselines, ADR 0061) removes the shared clean-baseline snapshot and its config-hash wipe. Each emulator is a copy of a source in its own AVD folder (task #1205), so creating one emulator can no longer invalidate another.
Written by an agent.
test(drivers): the recorder keeps every AVD's config.ini after an avd…
test(drivers): one contract suite holds both fake drivers to the real…