android-emulator-runner icon indicating copy to clipboard operation
android-emulator-runner copied to clipboard

ERROR | detected a hanging thread 'QEMU2 main loop'. No response for 20246 ms

Open ludovicroland opened this issue 8 months ago • 6 comments

Hello,

I am trying to use this action in order to run instrumented tests on my multi-module application using this configuration:

- name: run android tests
  uses: reactivecircus/android-emulator-runner@v2
  with:
    target: google_apis_playstore
    arch: x86_64
    api-level: 35
    script: ./gradlew runAndroidTests

The runAndroidTests task is a custom gradle task that depends on Jacoco tasks:

target.tasks.register("runAndroidTests") {
      dependsOn(
        ":ads:createFubukiGoogleDebugCoverageReport",
        ":app:createFubukiGoogleDebugCoverageReport",
        ":cookies:createFubukiGoogleDebugCoverageReport",
        ":core:createFubukiGoogleDebugCoverageReport",
        ":game:createFubukiGoogleDebugCoverageReport",
        ":home:createFubukiGoogleDebugCoverageReport",
        ":licenses:createFubukiGoogleDebugCoverageReport",
        ":notifications:createFubukiGoogleDebugCoverageReport",
        ":our_apps:createFubukiGoogleDebugCoverageReport",
        ":release_notes:createFubukiGoogleDebugCoverageReport",
        ":settings:createFubukiGoogleDebugCoverageReport",
        ":shop:createFubukiGoogleDebugCoverageReport"
      )
    }

It seems that the emulator is launched correcly, but my custom task takes time to configure everything before launch the tests and it alway fails with the following error message:

/usr/bin/sh -c ./gradlew runAndroidTests
> Task :build-logic:convention:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :build-logic:convention:compileKotlin UP-TO-DATE
> Task :build-logic:convention:compileJava NO-SOURCE
> Task :build-logic:convention:pluginDescriptors UP-TO-DATE
> Task :build-logic:convention:processResources UP-TO-DATE
> Task :build-logic:convention:classes UP-TO-DATE
> Task :build-logic:convention:jar UP-TO-DATE
> Task :ads:preBuild UP-TO-DATE
> Task :ads:preFubukiGoogleDebugBuild UP-TO-DATE
> Task :ads:generateFubukiGoogleDebugResValues UP-TO-DATE
> Task :ads:generateFubukiGoogleDebugResources UP-TO-DATE
> Task :ads:packageFubukiGoogleDebugResources UP-TO-DATE
> Task :ads:parseFubukiGoogleDebugLocalResources UP-TO-DATE
> Task :ads:generateFubukiGoogleDebugRFile UP-TO-DATE
> Task :ads:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :core:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :core:preBuild UP-TO-DATE
> Task :core:preFubukiGoogleDebugBuild UP-TO-DATE
> Task :core:generateFubukiGoogleDebugResValues UP-TO-DATE
> Task :core:generateFubukiGoogleDebugResources UP-TO-DATE
> Task :core:packageFubukiGoogleDebugResources UP-TO-DATE
> Task :core:parseFubukiGoogleDebugLocalResources UP-TO-DATE
> Task :core:generateFubukiGoogleDebugRFile UP-TO-DATE
> Task :core:kspFubukiGoogleDebugKotlin UP-TO-DATE
> Task :core:compileFubukiGoogleDebugKotlin UP-TO-DATE
> Task :core:javaPreCompileFubukiGoogleDebug UP-TO-DATE
> Task :core:compileFubukiGoogleDebugJavaWithJavac UP-TO-DATE
> Task :core:bundleLibCompileToJarFubukiGoogleDebug UP-TO-DATE
> Task :ads:kspFubukiGoogleDebugKotlin UP-TO-DATE
> Task :ads:compileFubukiGoogleDebugKotlin UP-TO-DATE
> Task :ads:javaPreCompileFubukiGoogleDebug UP-TO-DATE
> Task :ads:compileFubukiGoogleDebugJavaWithJavac UP-TO-DATE
> Task :core:bundleLibRuntimeToJarFubukiGoogleDebug UP-TO-DATE
> Task :ads:transformFubukiGoogleDebugClassesWithAsm UP-TO-DATE
> Task :ads:bundleLibCompileToJarFubukiGoogleDebug UP-TO-DATE
> Task :ads:preFubukiGoogleDebugAndroidTestBuild UP-TO-DATE
> Task :ads:writeFubukiGoogleDebugAarMetadata UP-TO-DATE
> Task :core:writeFubukiGoogleDebugAarMetadata UP-TO-DATE
> Task :test:preBuild UP-TO-DATE
> Task :test:preDebugBuild UP-TO-DATE
> Task :test:writeDebugAarMetadata
> Task :ads:checkFubukiGoogleDebugAndroidTestAarMetadata
> Task :ads:compileFubukiGoogleDebugLibraryResources UP-TO-DATE
> Task :ads:generateFubukiGoogleDebugAndroidTestResValues
> Task :test:generateDebugResValues
> Task :test:generateDebugResources
> Task :test:packageDebugResources
> Task :ads:mapFubukiGoogleDebugAndroidTestSourceSetPaths
> Task :ads:generateFubukiGoogleDebugAndroidTestResources
> Task :ads:mergeFubukiGoogleDebugAndroidTestResources
> Task :ads:extractDeepLinksFubukiGoogleDebug UP-TO-DATE
> Task :ads:processFubukiGoogleDebugManifest UP-TO-DATE
> Task :core:extractDeepLinksFubukiGoogleDebug UP-TO-DATE
> Task :core:processFubukiGoogleDebugManifest UP-TO-DATE
> Task :test:extractDeepLinksDebug
> Task :test:processDebugManifest
> Task :ads:processFubukiGoogleDebugAndroidTestManifest
> Task :core:compileFubukiGoogleDebugLibraryResources UP-TO-DATE
> Task :test:compileDebugLibraryResources
> Task :test:parseDebugLocalResources
> Task :test:generateDebugRFile
> Task :test:checkKotlinGradlePluginConfigurationErrors SKIPPED
> Task :ads:processFubukiGoogleDebugAndroidTestResources
> Task :test:javaPreCompileDebug
> Task :ads:javaPreCompileFubukiGoogleDebugAndroidTest
> Task :ads:mergeFubukiGoogleDebugAndroidTestShaders
> Task :ads:compileFubukiGoogleDebugAndroidTestShaders NO-SOURCE
> Task :ads:generateFubukiGoogleDebugAndroidTestAssets UP-TO-DATE
> Task :ads:mergeFubukiGoogleDebugShaders
> Task :ads:compileFubukiGoogleDebugShaders NO-SOURCE
> Task :ads:generateFubukiGoogleDebugAssets UP-TO-DATE
> Task :ads:mergeFubukiGoogleDebugAssets
> Task :core:mergeFubukiGoogleDebugShaders
> Task :core:compileFubukiGoogleDebugShaders NO-SOURCE
> Task :core:generateFubukiGoogleDebugAssets UP-TO-DATE
> Task :core:mergeFubukiGoogleDebugAssets
> Task :test:mergeDebugShaders
> Task :test:compileDebugShaders NO-SOURCE
> Task :test:generateDebugAssets UP-TO-DATE
> Task :test:mergeDebugAssets
> Task :test:kspDebugKotlin
> Task :ads:mergeFubukiGoogleDebugAndroidTestAssets
> Task :ads:compressFubukiGoogleDebugAndroidTestAssets
> Task :test:compileDebugKotlin
> Task :test:compileDebugJavaWithJavac NO-SOURCE
> Task :ads:checkFubukiGoogleDebugAndroidTestDuplicateClasses
> Task :ads:desugarFubukiGoogleDebugAndroidTestFileDependencies
> Task :test:transformDebugClassesWithAsm
> Task :ads:mergeExtDexFubukiGoogleDebugAndroidTest
ERROR        | detected a hanging thread 'QEMU2 main loop'. No response for 20246 ms
ERROR        | detected a hanging thread 'QEMU2 main loop'. No response for 16787 ms

I also tried to run another gradle task on the script part:

      - name: run android tests
        uses: reactivecircus/android-emulator-runner@v2
        with:
          target: google_apis_playstore
          arch: x86_64
          api-level: 35
          script: ./gradlew :ads:createFubukiGoogleDebugCoverageReport

But the result is exactly the same and it fails on the same task:

> Task :ads:mergeExtDexFubukiGoogleDebugAndroidTest
ERROR        | detected a hanging thread 'QEMU2 main loop'. No response for 18296 ms
ERROR        | detected a hanging thread 'QEMU2 main loop'. No response for 17744 ms

ludovicroland avatar Mar 27 '25 15:03 ludovicroland

Have you tried an older API level? Also curious if you're running the action with linux or macos runner?

ychescale9 avatar Mar 27 '25 23:03 ychescale9

Hello,

I tried with the api-level 34.

It failed too, but I do not have logs about an error with the emulator.

It seems that github action just stops to work during the tasks configuration of gradle. I do not have any logs.

ludovicroland avatar Apr 08 '25 14:04 ludovicroland

I am seeing the same as @ludovicroland. It seems to stop during the tasks configuration of gradle. I'm running against api 29.

JoDaC avatar Apr 08 '25 21:04 JoDaC

I'm seeing this issue too (API 29)

JesusM avatar Apr 20 '25 09:04 JesusM

Running into this issue any time I specify a profile (like pixel_tablet, medium_tablet, Nexus 6, pixel_3_xl) (API levels 34 - 31). Because the default emulator only has a screen size of 320x640, and my E2E tests need a bigger screen size, modifying the AVD config.ini using pre-emulator script to modify screen size and density always leads to this error for me. Also tried bumping up the RAM, heap size, etc. using the config options provided or directly modifying config.ini before booting up the emulator (ensuring cold boot), still run into the same error.

Running on ubuntu-latest. This is getting super flaky for my tests, but it would be awesome to hopefully reach some sort of stable fix one day.

Edit: It was a resource related issue for me. The free GitHub CI runner didn't have enough resources to run my workflow stably. Upgrading to a custom runner with a bit more resources worked for me. I did try cleaning up the free runner to create some more disk space and it gave me positive results, but not enough for my workflow. Hope this helps!

ahmed-vish avatar May 30 '25 14:05 ahmed-vish

Hi I'm getting this same issue for API 28 profile nexus 4 running on ubuntu-latest. this what error i am getting.

ERROR | detected a hanging thread 'QEMU2 main loop'. No response for 19002 ms ERROR | detected a hanging thread 'QEMU2 main loop'. No response for 18755 ms [2478:2478:20250627,152707.854023:ERROR ptracer.cc:422] ptrace: No such process (3) [2478:2478:20250627,152707.899595:ERROR ptracer.cc:446] Unexpected registers size 0 != 216 [2478:2478:20250627,152707.899607:WARNING process_reader_linux.cc:398] Couldn't initialize main thread.

AAPT2 aapt2-8.1.1-10154469-linux Daemon #2 Failed to shutdown within timeout java.util.concurrent.TimeoutException: AAPT2 aapt2-8.1.1-10154469-linux Daemon #2: Failed to shut down within 30 seconds. Forcing shutdown

Kshitijsk29 avatar Jun 27 '25 19:06 Kshitijsk29

And update on this? I'm having the same issue.

BartNijland91 avatar Aug 14 '25 11:08 BartNijland91

On my side it seems that the issue does not come from the action but from the Runner I used. The configuration of free runners is to small for my project. Using a paid runner fixed the issue.

ludovicroland avatar Aug 14 '25 20:08 ludovicroland

I'm having the same issue on image ubuntu-24.04. @ludovicroland When you say the free runner is too small, what do you mean by small?

larry-cariq avatar Sep 09 '25 14:09 larry-cariq

I'm having the same issue on image ubuntu-24.04. @ludovicroland When you say the free runner is too small, what do you mean by small?

Not powerful enough (CPU, RAM, etc.).

ludovicroland avatar Sep 09 '25 14:09 ludovicroland