A hung adb shell getprop in waitForBoot stalls the emulator boot wait until "The platform did not become ready"

未关闭 适合新手
#309 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
react-native, typescript
领域
mobile, testing

调研方向

先追踪 waitForBoot 到 isBootCompleted 和 getShellProperty 的调用链,然后检查项目如何启动 adb 命令,以及如何处理超时或中止信号。使用链接的复现脚本(repro.mjs)重现卡住的 getprop 调用;当被中止的等待能够从该调用中恢复,并在模拟器报告启动完成时得到解决,即为完成。

由索引模型根据 Issue 内容生成。

描述

Describe the bug

On CI, I'm experiencing Android tests intermittently fail with "The platform did not become ready". With verbose logging on, the last thing the harness does is poll adb shell getprop sys.boot_completed while the emulator boots, and that call never returns.

waitForBoot checks its abort signal between polls:

while (!signal.aborted) {
  // getDeviceIds → getEmulatorName → isBootCompleted
  await waitWithSignal(1000, signal);
}

But isBootCompleted goes through getShellProperty, which spawns adb with no timeout and without the signal. If one adb shell call hangs during early boot, the loop never polls again, even after the emulator has booted, and never sees the abort. The run sits there until platformReadyTimeout fails it.

No idea why adb shell hangs.

I've included a workaround patch that seems to resolve this in the repro sample.

System Info
CI: GitHub-hosted ubuntu-26.04 runner, via the react-native-harness GitHub action (v1.6.0)
Emulator: API 27, Nexus 6 profile, x86_64, AVD created fresh each run (cacheAvd: false)
React Native Harness Version

1.6.0

Reproduction

https://github.com/bryan-lamb777/react-native-harness-adb-boot-hang-repro

Steps to reproduce

The repro simulates the hang without an emulator. A fake adb reports one emulator, hangs on the first getprop sys.boot_completed, and reports the emulator as booted on every later call. repro.mjs calls waitForBoot with a signal that aborts after 30s, standing in for platformReadyTimeout.

  1. pnpm install
  2. pnpm repro

Expected: waitForBoot gives up on the hung call, polls again and resolves the emulator

Actual: waitForBoot is still pending 15s after the signal aborts. Only one getprop is ever made:

[0.0s] waiting for emulator "test-avd" to boot
[30.0s] signal aborted
[45.0s] FAIL: waitForBoot is still pending 15s after the signal aborted.
adb calls made:
  adb devices
  adb -s emulator-5554 emu avd name
  adb -s emulator-5554 shell getprop sys.boot_completed

To see the workaround pass, uncomment patchedDependencies in pnpm-workspace.yaml and run pnpm install again.

主要语言
TypeScript
星标
341
派生
25
平均合并
9 小时 46 分钟
30 天内合并 PR
1

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

callstackincubator/react-native-harness 的其他 Issue

查看 callstackincubator/react-native-harness 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。