Status Update
Comments
ma...@google.com <ma...@google.com>
an...@google.com <an...@google.com>
da...@gmail.com <da...@gmail.com> #2
The attached Build Scan log shows that the emulator process crashed unexpectedly. Could you rerun your task with --info
and -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
to get more information about the emualtor process logs?
ch...@google.com <ch...@google.com> #3
ae...@gmail.com <ae...@gmail.com> #4
No idea why the scan does not contain log information, here you are:
ol...@gmail.com <ol...@gmail.com> #5
The link in --info
and -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
, the emulator process output its kernel logging to stdout. Do you see any stacktrace or segfault in the log?
ae...@gmail.com <ae...@gmail.com> #6
That's strange, the repo and the build is public... But I attached the logs as file
an...@gmail.com <an...@gmail.com> #7
I looked into the logs and it turns out, the runner didn't have enough disk space. I guess the root cause is the Gradle update causing another Gradle major version (and its new transform-4) folder to cache was too much. Anyway, a better error message of the exit code of GMD would be helpful.
jo...@gmail.com <jo...@gmail.com> #8
Thanks for uploading the log! Yes, the emulator kernel log says the issue was the insufficient disk space:
2024-04-02T18:31:45.7078429Z ERROR | Not enough space to create userdata partition. Available: 7177.027344 MB at /home/runner/.config/.android/avd/gradle-managed/dev34_aosp_atd_x86_64_Pixel_2.avd, need 7372.800000 MB.
Also, I agreed that GMD should diagnose errors and can provide better messages.
Let me rename this issue's title to improve the error message for disk space error.
ae...@gmail.com <ae...@gmail.com> #9
I've added a fix that will surface all error messages from the emulator in the exception when it closes unexpectedly.
ol...@gmail.com <ol...@gmail.com> #10
Thank you for your patience while our engineering team worked to resolve this issue. A fix for this issue is now available in:
- Android Studio Meerkat | 2024.3.1 Canary 2
- Android Gradle Plugin 8.9.0-alpha02
We encourage you to try the latest update.
If you notice further issues or have questions, please file a new bug report.
Thank you for taking the time to submit feedback — we really appreciate it!
ae...@gmail.com <ae...@gmail.com> #11
Please see the duplicated issue:
as...@gmail.com <as...@gmail.com> #12
Please treat this as a critical bug.
Fatal Exception: java.lang.IllegalStateException: You cannot access the NavBackStackEntry's ViewModels after the NavBackStackEntry is destroyed.
at androidx.navigation.NavBackStackEntry.getViewModelStore(NavBackStackEntry.kt:202)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:104)
at androidx.navigation.compose.NavHostKt.NavHost(NavHost.kt:67)
ch...@google.com <ch...@google.com> #13
Compose does not ensure repeatable read consistency across a sub-composition boundary (that is we do not guarantee that a mutable value read by the parent composition will be the same value read by the sub-composition).
However, as I noted above, we will be changing the runtime to avoid recomposing sub-compositions that have been detected in the parent composition as being removed, point (2) in
These two changes will change the rules so that the assumption how data dependencies are handled across sub-composition boundaries, as is implied by the assert
above in setContent
of a Composition
to be violated. When and why setContent
is called is in the hands to the code that created the composition, not the recomposer, or the rest of the runtime, which is why we cannot guarantee the assert assumption will always hold.
Theses changes will not ensure repeatable read consistency across a sub-composition boundary, but they will make it much easier for code to avoid requiring it by avoiding recomposing code that is being removed. Because repeatable read consistency is not guaranteed it is recommended that code not rely on it and avoid it by avoiding repeating reads as shown in the examples in
I am sorry if my calling this a feature request above implied a lack of priority. We are treating this change as a high priority change for the next feature release. As it requires an API change and a change to the rules of how composition works I think of it as a feature request but will leave it marked as a bug type to avoid confusion.
ap...@google.com <ap...@google.com> #14
Branch: androidx-main
commit 9f3a404d3117ed29b3ced1f2e29134237bf6baa1
Author: Ben Trengrove <bentrengrove@google.com>
Date: Thu Jun 01 15:56:39 2023
Skip recomposition of subcompositions that will be removed
Compose does not ensure repeatable read consistency across a sub-composition boundary (that is we do not guarantee that a mutable value read by the parent composition will be the same value read by the sub-composition). However in cases where we can detect that a subcomposition will be removed in the next applyChanges, we can skip recomposing that
subcomposition.
This is accomplished by keeping a map of removed compositions reported via the composition context.
When a composition is marked for deletion, it checks through its marked groups for any nested composition contexts. For each one it finds, reports its deletion to the recomposer via the context. When the nested composition is
recomposed, if the recomposers map of removed compositions contains the composition, it is skipped.
This change is an improvement on current behaviour but could be improved by ensuring parent compositions are always recomposed before any nested compositions. This mostly already occurs but making this enforced would further improve this situation and is why the linked bug is not yet considered fixed.
Bug: 254645321
Relnote: Skip recomposition of subcompositions that will be removed
Test: testSubcompositionDisposedInParent
Change-Id: Ieeb9919897a9f9b4274ddc77e66608a673cd1112
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Composer.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/CompositionContext.kt
M compose/runtime/runtime/src/commonMain/kotlin/androidx/compose/runtime/Recomposer.kt
M compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/RecomposerTests.kt
ch...@google.com <ch...@google.com> #15
As Ben and I found a relatively fast and safe way to fix this that didn't involve an API changes, we have started the process to cherry-pick this to earlier releases.
ri...@ffw.com <ri...@ffw.com> #16
Which version is this in / going to be in?
ch...@google.com <ch...@google.com> #17
This issue will be updated when it lands in a stable release.
ae...@gmail.com <ae...@gmail.com> #18
ch...@google.com <ch...@google.com> #19
I could not reproduce the crash above with 1.6.0-alpha01
The steps I took where:
- Created a new android project using
Android Studio Giraffe | 2022.3.1 RC 1
- Replaced
Greeting
with the code in #1 (fixing the imports) - Ran the program
- Pressed the button (crash reproduced)
- Added the line
implementation("androidx.compose.runtime:runtime:1.6.0-alpha01")
to the dependencies - Update the compile sdk to 34.
- Sync'ed gradle
- Ran the program
- Pressed the button (no crash)
ch...@google.com <ch...@google.com> #20
Note the above fix is only a partial fix. There are cases that will continue to violate the implied constraint until the second part of the fix lands (explained above).
Also note that this doesn't guarantee the constraint implied by the assert will always hold, only that the runtime will try to avoid recomposing sub-compositions that might be exposed to the constraint. Any use of sub-composition can violate this constraint as the value might change between the time the main composition composes and the sub-composition composes and before the main composition can be recomposed to remove the sub-composition.
If you require consistency between a composition and its subcomposition you need to capture the state as #5, above. This change just avoids a common case would violate this constraint.
Description
Jetpack Compose version: 1.2.1 (also tested on 1.3.0-rc01)
Jetpack Compose component(s) used: foundation, material
Here is the most simplified version of the code that led me to mysterious crashes when using ModalBottomSheetLayout:
When the button is clicked the code crashes, although you would not expect this just looking at the code. You would expect BoxWithConstraints to be removed from composition as soon as the
value
becomesfalse
.And if you replace BoxWithConstraints with regular Box it would work without assertion crash however.
If I understand correctly, the SubcomposeLayout causes its content to be recomposed without regards to the outer check. Which may be fine if you know about this behaviour and expect it. However in case of higher level composables such as ModalBottomSheetLayout it hides the underlying behaviour which may lead to similar unexpected crashes.
I don't know but to me it seems like a flaw. Please correct me if I'm just not doing something correctly.