Skip to content

Android: a stale emulator crash dump makes every boot wait on a crash-report dialog until the lease times out #1183

Closed

Description

@V3RON

What happened

After an emulator crash, every later Android lease on that Mac failed with INTERNAL: Timed out waiting for device to boot after about 182 s. This happened on the slow lane on 2026-11-01, five runs in a row.

The emulator never booted. A stack sample of qemu-system-aarch64 showed its main thread at 100% CPU inside CrashConsentProvider::showDialog → QDialog::exec(), called from CrashSystem::uploadEntries. It was waiting for a person to answer the "send crash report?" dialog. The trigger was one dump an earlier crash left in /tmp/android-<user>/emu-crash-36.5.11.db/completed/ (4.4 MB). Every launch found it and showed the dialog. The console port and the gRPC port never opened.

Why it matters

A worker Mac with no one at the screen loses every Android lease until someone removes the dump by hand. Nothing explains why: the driver starts the emulator with stdio: "ignore", so the daemon log has only BootTimeoutError at the boot step.

How to reproduce

  1. Put any .dmp file in /tmp/android-$USER/emu-crash-<emulator version>.db/completed/.
  2. Lease an Android emulator: simlock lease android.
  3. The lease fails after the boot timeout, and the emulator window shows the crash-report dialog.

Moving the dump out of that folder fixes the next lease.

Environment

macOS on arm64. Emulator 36.5.11.0, AVD android-37.0 google_apis_playstore_ps16k. The driver's command line: emulator -avd simlock_<uuid> -port <p> -no-snapshot-save -grpc <g> -grpc-use-token -no-snapshot-load.

Written by an agent.

Activity

  1. added
    bug:newReported. An agent may triage it (rule 8); the fast track may set it ready (rule 17).
    on Nov 1, 2026
  2. self-assigned this
    on Nov 1, 2026
  3. V3RON commented on Nov 1, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed. Gap: the driver never tells the emulator how to handle crash reports, so the emulator falls back to asking a person. The test's expected flag is a proposal.

    src/drivers/android/index.test.ts, "starts the cold boot and the restart from the baseline with -crash-report-mode never, so a stale crash dump asks no one", on bug/1183-repro (d84762a).

    pnpm exec vitest run --project unit src/drivers/android/index.test.ts -t "crash-report-mode never"
    
    - { "boot": "-no-snapshot-load",      "crashReportMode": "never" }
    + { "boot": "-no-snapshot-load",      "crashReportMode": undefined }
    - { "boot": "simlock_clean_baseline", "crashReportMode": "never" }
    + { "boot": "simlock_clean_baseline", "crashReportMode": undefined }
    

    What I read on the host (emulator 36.5.11): emulator -help-all and the strings in qemu-system-aarch64.

    -crash-report-mode <option list>   Override crash reporting mode. Available options: disabled, never, always, ask
    "No consent for crashreport %s, deleting."
    "Failed to get consent, keeping %s for now."
    "Showing crashdialog to get consent."
    

    Root cause

    src/drivers/android/index.ts:2227 (#startEmulator) builds every emulator command line from fixed flags plus emulatorLaunchFlags (:2835), and none of them sets -crash-report-mode. With no override, the emulator uses the user's saved setting, which defaults to ask. At startup it opens a modal consent dialog for each dump in emu-crash-<version>.db/completed/. The dialog blocks the main thread, so the console and gRPC ports never open. The symptom is BootTimeoutError in #waitForReadiness, with no reason in the log, because the emulator runs with stdio: "ignore" (:2241).

    Simplest fix

    Add "-crash-report-mode", "never" to the fixed flags in #startEmulator. Then update the tests that compare the full argv (baselineBuildExpectations, the cold-boot, baseline and launch-option tests). Going by the binary's strings, never also deletes the stale dump.

    Alternatives rejected

    • disabled: no dialog, but the dump stays forever and new crashes are not recorded.
    • Deleting /tmp/android-$USER/emu-crash-*.db/completed/*: that is the user's crash database, outside the owned root (ADR 0001).
    • Setting ANDROID_EMU_CRASH_REPORTING_DATABASE per root: the default mode is still ask.

    Risk

    • never is untested on hardware. A slow-lane boot with a .dmp in completed/ should confirm no dialog and that the dump is deleted.
    • Only the argv changes, so baselines should be unaffected. Check that baselineLaunchInputs stays as it is.
    • Older emulators may not know the flag. requirements.mdx sets no minimum emulator version.

    Written by an agent.

  4. removed their assignment
    on Nov 1, 2026
  5. added
    bug:readyAn agent may fix it.
    and removed
    bug:newReported. An agent may triage it (rule 8); the fast track may set it ready (rule 17).
    on Nov 1, 2026
  6. self-assigned this
    on Nov 1, 2026
  7. V3RON commented on Nov 1, 2026

    @V3RON
    ContributorAuthor

    Decision taken

    Question: -crash-report-mode never alone makes the emulator delete every pending dump in the user's shared crash database (/tmp/android-<user>/emu-crash-<version>.db). Android Studio and the user's own emulators write there too. Review finding R1 says this touches files Simlock did not write.

    Options:

    1. never alone. No dialog. The emulator deletes the user's dumps from Android Studio and other emulators too, without asking.
    2. never plus ANDROID_EMU_CRASH_REPORTING_DATABASE set to a folder in Simlock's root. No dialog. Simlock's emulators record and drop crash dumps only in Simlock's folder. The user's shared folder is not read or touched.
    3. disabled. No dialog, but crashes are not recorded at all.

    Taken: option 2. It keeps Simlock inside its own root (ADR 0001) and still fixes the boot hang. The triage rejected the variable only on its own, without never.

    Reverting: drop the env var from the emulator spawn (one line) to get option 1.

    The fast tests can't prove the emulator honours the variable. A hardware check will: a .dmp in the shared completed/ folder, a lease boots with no dialog, and the .dmp is still there.

    Written by an agent.

  8. V3RON commented on Nov 1, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: #1186 (#1183)
    Decided: #1183 — -crash-report-mode never alone deletes the user's shared crash dumps → also point the emulator at a crash database inside Simlock's root

    Written by an agent.

  9. added a commit that references this issue on Nov 3, 2026
    20c3640
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug:readyAn agent may fix it.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions