Espresso.onIdle() hangs forever on Android 17 (API 37) with the new MessageQueue (DeliQueue): an overdue sync FutureTask is never delivered after a configuration change
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 10/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Bereich
- mobile-dev, testing-qa
Rechercherichtung
Start by reproducing on an API 37 emulator and capturing the same looper dump plus the Espresso side of the wait: Espresso.onIdle (Espresso.java:349) and UiControllerImpl.loopMainThreadUntilIdle, where ComposeIdlingResource.checkLayoutBusy reportedly stays busy. Toggling adb shell am compat disable USE_NEW_MESSAGEQUEUE <package> isolates the DeliQueue path, but the root cause is not yet known and there is no minimal project, so the first deliverable is a deterministic repro and a documented mechanism, not a patch.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Environment
- Espresso 3.7.0 (also reproduced with 3.8.0-alpha01); androidx.test 1.7.0; Compose BOM 2026.09.00 (
ui-test-junit4,createAndroidComposeRule) - Android Emulator, Android 17 (API 37) system image, revision 8; the app targets and compiles against API 37
- Kotlin 2.4.21, AGP 9.5.1
What happens
In an instrumented end-to-end test with AndroidComposeTestRule, right after rotating the device (the activity is recreated), the test thread blocks forever inside Espresso.onIdle(), called by Compose's waitForIdle():
"Instr: com.soultechnologynhz.chat.HiltTestRunner" WAITING
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at androidx.test.espresso.Espresso.onIdle(Espresso.java:349)
at androidx.test.espresso.Espresso.onIdle(Espresso.java:378)
at androidx.compose.ui.test.EspressoLink_androidKt.runEspressoOnIdle(EspressoLink.android.kt:88)
at androidx.compose.ui.test.EspressoLink.runUntilIdle(EspressoLink.android.kt:82)
at androidx.compose.ui.test.AndroidComposeUiTestEnvironment.waitForNextChoreographerFrame(ComposeUiTest.android.kt:736)
at androidx.compose.ui.test.AndroidComposeUiTestEnvironment.waitForIdle(ComposeUiTest.android.kt:719)
at androidx.compose.ui.test.junit4.AndroidComposeTestRule.waitForIdle(AndroidComposeTestRule.android.kt:495)
The main thread is idle, polling the new queue:
"main" RUNNABLE
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.nextDeliQueue(MessageQueue.java:791)
at android.os.MessageQueue.next(MessageQueue.java:771)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:397)
The dump of the main looper, taken at the same moment, shows Espresso's FutureTask as the first message, already due (when=0), synchronous, and never delivered, while only asynchronous coroutine messages follow:
Looper (main, tid 2) {9963b5e}
(MessageQueue is using DeliQueue implementation)
Message 0: { when=0 callback=java.util.concurrent.FutureTask target=android.os.Handler async=false heapIndex=-1 }
Message 1: { when=+18s950ms callback=kotlinx.coroutines.android.HandlerContext$$ExternalSyntheticLambda1 target=android.os.Handler async=true heapIndex=3 }
Message 2: { when=+18s950ms callback=kotlinx.coroutines.android.HandlerContext$$ExternalSyntheticLambda1 target=android.os.Handler async=true heapIndex=1 }
Message 3: { when=+18s950ms callback=kotlinx.coroutines.android.HandlerContext$$ExternalSyntheticLambda1 target=android.os.Handler async=true heapIndex=0 }
Message 4: { when=+11h52m17s497ms callback=kotlinx.coroutines.android.HandlerContext$$ExternalSyntheticLambda1 target=android.os.Handler async=true heapIndex=2 }
(Total messages: 5, polling=true, quitting=false)
This looks like a synchronization barrier left in the queue after the recreation (sync messages held, async ones allowed), which the dump does not list. In another occurrence the main thread was instead busy in UiControllerImpl.loopMainThreadUntilIdle, with ComposeIdlingResource.checkLayoutBusy answering "busy" forever.
How often
- About 1 in 3 full runs on the Android 17 emulators, since 25/10/2026: 8 occurrences, mostly in the rotation test, once in a test without a rotation (already at the app launch, in
compose.waitForIdle, with Espresso'sListenableFutureTask"+1ms" never delivered). - The rotation test alone passed 9 out of 9; the hang shows up in full runs.
- The screen is always correct in the screenshot taken at the timeout: only the idle wait never returns.
What changes it
- With the old queue for the app (
adb shell am compat disable USE_NEW_MESSAGEQUEUE <package>): 0 hangs in 3 full runs. - With Espresso 3.8.0-alpha01: 2 hangs in 3 runs on Android 17, and 1 in 3 also on Android 10.
We do not have a minimal standalone project yet; we can run more diagnostics on request.
- Vorherrschende Sprache
- Java
- Sterne
- 1.2k
- Forks
- 343
- Ø Merge
- 1 T. 18 Std.
- Gemergte PRs (30 T.)
- 16
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus android/android-test
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 62/100
android/android-test#681 · 2 Kommentare · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 52/100
android/android-test#2544 ·
Maintainer antworten meist innerhalb von 1 Tag
-
ξεκσνδξδOffen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 1/100
android/android-test#2499 ·
Maintainer antworten meist innerhalb von 1 Tag
-
ησξξσOffen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 1/100
android/android-test#2498 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 38/100
android/android-test#2473 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in android/android-test
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
bloxbean/yaci-store#1445 ·
Maintainer antworten meist innerhalb von 1 Tag
-
图片灯箱过长的话底部carousel滑动没有惯性Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100