Repository navigation
Description
Summary
On the 2 GB google_apis_playstore lab AVD (picklab-avd, API 37, 4 cores, hw.ramSize=2G), the first android launch-app of a freshly sideloaded APK right after a quickboot restore can die within seconds, while am start -W reports the activity drawn. The product now fails loudly (launch of <pkg> was accepted ... but no <pkg> process is alive after 10000ms, #101), and the pass scripts and the live test retry after a bounded readiness wait. This issue tracks the remaining product-side work.
What was measured (PR #101, investigation-first-launch/ under the #93 board)
Each trial boots a fresh btrfs reflink clone of the AVD from a fully isolated HOME / AVD home / Pickforge home / adb server, samples /proc/meminfo, /proc/loadavg, /proc/pressure/io and logcat every 2 s, and launches the release APK.
| Trial | Boot | Install | Launch timing | First launch | lowmemorykiller kills |
|---|---|---|---|---|---|
| 1 | warm, writable | reinstall over an existing package | immediately | survived (60 s watch) | 0 |
| 2 | warm, writable | uninstall, then fresh sideload | immediately | killed after 13 s, rejected by launch-app |
420 |
| 3 | warm, read-only | uninstall, then fresh sideload | immediately | survived | 17 |
| 4 | warm, writable | uninstall, then fresh sideload | readiness probe: storm never quiet, gave up at 240 s | killed after 11 s; second launch 240 s later killed after 3 s | 819 (load1 14.9, storm still running 8 min after restore) |
| 5 | warm, writable | uninstall, then fresh sideload | probe satisfied at once (no kill in the buffer) | survived | 17 (later) |
| 6 | warm, writable | uninstall, then fresh sideload | probe satisfied after 31 s | survived | 16 (later) |
Facts from the guest at restore time (all trials): MemFree 32-55 MB, SwapFree 0-5 MB of 377 MB, MemAvailable 760-1200 MB, load1 6.0 falling to 2.4 over a minute, io PSI full avg10 55-66 (the restore's lazy RAM page-in), /proc/pressure/memory unreadable from the shell on the Play image.
So the trigger is the fresh sideload on the Play image (trials 1 and 3 with a reinstall or a read-only boot did not trip it, trials 2, 4 and 5/6 with the same fresh sideload went three different ways), and the outcome is a race: the storm in trial 2 starts two seconds after the install completes, i.e. while Play Protect verifies the sideload and the app starts: lowmemorykiller: Kill 'com.google.android.apps.nexuslauncher' ... oom_score_adj 0 ... reason: min watermark is breached and swap is low, repeated for the launcher, com.google.android.gms, gms.persistent, the app, and every other adj-0 process, hundreds of times. MemAvailable stays around 1 GB throughout, so MemAvailable, load and io pressure do not predict the kill (trial 1 launched fine at load 6 and io PSI 57). The direct, observable signal is lowmemorykiller itself: no lowmemorykiller: Kill line for 30 s (logcat -d -v epoch against the guest clock). A launch after the storm ends survives (trial 2, second launch; trials 5 and 6). But the storm is not always transient: in trial 4 the guest thrashed for the whole eight minutes of the trial (819 kills, load1 14.9) and both launches died, so no bounded readiness wait is reliable on this image; it only avoids launching into a transient storm.
Proposed product work
- Bounded readiness in the product, not only in the harness.
android launch-app/android_launch_app(orandroid install-apk) gain an opt-in bounded wait (--wait-ready <s>, default off) that launches only once lowmemorykiller has been quiet for N seconds, reporting each probe as progress and failing with the existing distinct error when the bound is hit. The harness implementation to lift iswait_guest_readyinrun-isolated-pass.shandwaitForGuestSettledinpackages/android/test/integration.test.ts. Provision the Pickforge AVD with headroom.Moved to Android: provision pickforge-avd with RAM headroom and a settled first snapshot #106.picklab-avdstays untouched.- Document the limit. README / release notes: on 2 GB Play images the first launch of a fresh sideload may be dropped by the guest; Pickforge reports it, and the retry belongs to the caller until (1) lands.
Checklist
- Opt-in
--wait-ready/waitReadySecondsin CLI and MCP, default off, fail-closedguest-not-ready/aborted, no product retry (PR feat(android): opt-in bounded guest readiness before launch or install #107) - Split
pickforge-avdRAM and settled-snapshot provisioning into Android: provision pickforge-avd with RAM headroom and a settled first snapshot #106 - Document the 2 GB Play-image first-launch limit in README / release notes
Closing this issue means items 1 and 3 shipped. Default callers still have no wait. The kill itself is not gone; it is avoidable when a caller opts in. A storm that never quiets still fails closed.
Out of scope
Disabling Play Protect's sideload verifier in the guest (settings put global package_verifier_enable 0) would avoid the trigger but changes guest behaviour; leave it as a documented operator choice, not a Pickforge default.
Activity
docs(android): note the first-launch lowmemorykiller limit and its fo…
ElbertePlinio commentedon Sep 5, 2026
Product-safe part is in #107 (
--wait-ready/waitReadySeconds, default off,guest-not-readywithout starting the action, no retry).Evidence:
~/Projects/Boards/pickforge/0.4-release/android-readiness/. Isolated reflink clone ofpicklab-avd, not the real AVD. Positive launch 0 → 1 → 2, independent vision PASS. Negative--wait-ready 1after a syntheticlowmemorykiller: Killline failed closed.RAM / settled-snapshot provisioning is #106, not this PR.
picklab-avdwas not touched. #93 stays open.feat(android): add opt-in bounded guest readiness