Status Update
Comments
ro...@gmail.com <ro...@gmail.com> #2
Any updates?
rv...@google.com <rv...@google.com> #3
Could you please confirm the library versions?
Also, could you verify if this still happens without using the androidx.tv.foundation
library?
ro...@gmail.com <ro...@gmail.com> #4
I can't seem to remove the androix.tv.foundation
library since one of the composables are using:
import androidx.tv.foundation.lazy.list.TvLazyColumn
import androidx.tv.material3.Icon
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Surface
import androidx.tv.material3.Switch
import androidx.tv.material3.SwitchDefaults
import androidx.tv.material3.Text
Below is my build.gradle.kts file
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.plugin.compose")
//Added for Hilt Dependency Injection capabilities
id("com.google.dagger.hilt.android")
//Added for Firebase Cloud Messaging service
id("com.google.gms.google-services")
id("kotlin-kapt")
}
android {
namespace = "***.********.********"
compileSdk = 34
defaultConfig {
applicationId = "***.********.********"
minSdk = 28
targetSdk = 34
versionCode = 1
versionName = "1.0"
}
signingConfigs {
getByName("debug") {
keyAlias = "****"
keyPassword = "********"
storeFile = file("*****")
storePassword = "********"
}
create("release") {
keyAlias = "****"
keyPassword = "********"
storeFile = file("*****")
storePassword = "********"
}
}
buildTypes {
debug {
isMinifyEnabled = false
isShrinkResources = false
signingConfig = signingConfigs.getByName("debug")
isDebuggable = true
}
release {
isMinifyEnabled = true
isShrinkResources = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
signingConfig = signingConfigs.getByName("release")
isDebuggable = false
ndk {
debugSymbolLevel = "FULL"
}
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
// Allow for widescale experimental APIs in Alpha libraries we build upon
freeCompilerArgs += "-opt-in=androidx.compose.animation.ExperimentalAnimationApi"
}
buildFeatures {
compose = true
buildConfig = true
}
// Allow references to generated code
kapt {
correctErrorTypes = true
}
}
dependencies {
implementation("androidx.compose.foundation:foundation:1.7.0-beta03")
implementation("androidx.tv:tv-foundation:1.0.0-alpha10")
implementation("androidx.tv:tv-material:1.0.0-beta01")
implementation("androidx.compose.material3:material3:1.2.1")
implementation("androidx.compose.material:material-icons-extended:1.6.8")
implementation("androidx.compose.ui:ui-tooling-preview:1.7.0-beta03")
debugImplementation("androidx.compose.ui:ui-tooling:1.7.0-beta03")
debugImplementation("androidx.compose.ui:ui-test-manifest:1.7.0-beta03")
testImplementation("androidx.compose.ui:ui-test-junit4:1.7.0-beta03")
androidTestImplementation("androidx.compose.ui:ui-test:1.7.0-beta03")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.7.0-beta03")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.2")
implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.2")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.8.2")
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.2")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.2")
//Splash screen library
implementation("androidx.core:core-splashscreen:1.0.1")
//Android JetPack DataStore
implementation("androidx.datastore:datastore-preferences:1.1.1")
//Retrofit and GSON
implementation("com.squareup.retrofit2:retrofit:2.11.0")
implementation("com.squareup.retrofit2:converter-gson:2.11.0")
implementation("com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.14")
//Import Hilt Dependency Injection
implementation("com.google.dagger:hilt-android:2.51.1")
kapt("com.google.dagger:hilt-compiler:2.51.1")
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
// Import Firebase BoM (see: https://firebase.google.com/docs/android/learn-more#bom)
implementation(platform("com.google.firebase:firebase-bom:33.1.0"))
// Firebase Cloud Messaging
implementation("com.google.firebase:firebase-messaging")
// For an optimal experience using FCM, add the Firebase SDK
// for Google Analytics. This is recommended, but not required.
// When using the BoM, don't specify versions in Firebase dependencies
implementation("com.google.firebase:firebase-analytics")
//This library is used for showing and scanning QR Codes
implementation("com.google.zxing:core:3.5.3")
implementation(project(":shared"))
}
ro...@gmail.com <ro...@gmail.com> #5
Ok, I've managed to exclude the androix.tv.foundation
library. I can tell you more in about 3 days time from now.
as...@google.com <as...@google.com> #6
I don't think androidx.tv.foundation
is related here, likely it is a leak caused by vector composition.
as...@google.com <as...@google.com> #7
Would you be able to provide the icon that is animating here to help reproduce it locally?
ro...@gmail.com <ro...@gmail.com> #8
Sure, how can I share it with (only) you?
as...@google.com <as...@google.com> #9
It seems like rememberAnimatedVectorPainter
is active even if it is not being drawn / used.
A probable workaround is to do this:
painter = if (!started) {
painterResource(
id = R.drawable.ic_run_matchface
)
} else {
rememberAnimatedVectorPainter(animatedImageVector = runAnimIcon, atEnd = atEnd)
},
ro...@gmail.com <ro...@gmail.com> #10
Not sure I'm seeing the workaround here other than that the animation stops. Is that what you're trying to do? The icon is only 700ms or so long and the idea is that it needs to be repeated over and over again. I've noticed that getting a smooth transition from the animation reaching its end to restart is not that perfect. It would be better if compose would have a built-in option just to keep it repeating indefinitely or for x times or so. Just as there was in the Views system. Now I have to trick it like I did to get a smooth continuous animation.
And eventually with whatever workaround, there should be no memory leaks.
I can share the icon with you, but I'm not keen to share it with the whole world. Let me know how I can do that.
as...@google.com <as...@google.com> #11
Sorry for the confusion, I meant moving rememberAnimatedVectorPainter
inside else
block rather than hoisting it outside. I think it should result in the same result as before but will only start animating after started condition has switched.
Obviously, we want the memory leak to be fixed regardless. You can upload the icon to google drive and share with
ro...@gmail.com <ro...@gmail.com> #12
I've just send you two files. I forgot to mention that I have another icon with the same config. That is only shown when the systen detects that there is no network. Also, the aniomation is kicked off with a suspend function. Maybe there is a better way of doing this, but I couldn't find it.
var atEndNoNetwork by remember { mutableStateOf(false) }
val noNetworkAnimIcon = AnimatedImageVector.animatedVectorResource(R.drawable.ic_no_network)
val noNetworkAnimIconPainter1 = rememberAnimatedVectorPainter(animatedImageVector = noNetworkAnimIcon, atEnd = atEndNoNetwork)
val noNetworkAnimIconPainter2 = rememberAnimatedVectorPainter(animatedImageVector = noNetworkAnimIcon, atEnd = !atEndNoNetwork)
val isRunning by remember { mutableStateOf(true) }
suspend fun runAnimation() {
while (isRunning) {
delay(714)
atEnd = !atEnd
}
}
suspend fun noNetworkAnimation() {
while (isRunning) {
delay(3500)
atEndNoNetwork = !atEndNoNetwork
}
}
as...@google.com <as...@google.com> #13
It seems like the bug is in MutableObjectIntMap
implementation. In the attached heap dump, the RecomposeScopeImpl#trackedInstances
size is 1, but capacity is /very/ large.
ro...@gmail.com <ro...@gmail.com> #14
Did you find the rootcause yet?
as...@google.com <as...@google.com> #15
Yeah, I found the cause, the bugfix is pending.
as...@google.com <as...@google.com> #16
Regression test:
@Test
fun insertManyRemoveMany() {
val map = MutableScatterMap<Int, String>()
for (i in 0..1000000) {
map[i] = i.toString()
map.remove(i)
assertTrue(map.capacity < 16, "Map grew larger than 16 after step $i")
}
}
ro...@gmail.com <ro...@gmail.com> #17
Nice! Just let me know what I need to do to repeat my test with the bugfix in place.
ap...@google.com <ap...@google.com> #18
Branch: androidx-main
commit 5e6b6d143647f1b06e3297ce7e8af2d976aefa2b
Author: Andrei Shikov <ashikov@google.com>
Date: Mon Jun 03 21:12:23 2024
Remove deleted tombstones from Map/Set when resizing
The ScatterMap/Set were increasing capacity infinitely when adding and removing elements frequently.
Fixes: 345960092
Test: Updated collection tests
Change-Id: Ic72352b3209e463de8de2278896a4b1bf10bd832
M collection/collection-benchmark/src/androidInstrumentedTest/kotlin/androidx/collection/ScatterMapBenchmarkTest.kt
M collection/collection-benchmark/src/commonMain/kotlin/androidx/collection/ScatterMapBenchmarks.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/FloatFloatMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/FloatIntMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/FloatLongMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/FloatObjectMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/FloatSet.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/IntFloatMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/IntIntMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/IntLongMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/IntObjectMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/IntSet.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/LongFloatMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/LongIntMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/LongLongMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/LongObjectMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/LongSet.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/ObjectFloatMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/ObjectIntMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/ObjectLongMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/ScatterMap.kt
M collection/collection/src/commonMain/kotlin/androidx/collection/ScatterSet.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/FloatFloatMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/FloatIntMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/FloatLongMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/FloatObjectMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/FloatSetTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/IntFloatMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/IntIntMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/IntLongMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/IntObjectMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/IntSetTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/LongFloatMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/LongIntMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/LongLongMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/LongObjectMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/LongSetTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/ObjectFloatMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/ObjectIntMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/ObjectLongMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/ScatterMapTest.kt
M collection/collection/src/commonTest/kotlin/androidx/collection/ScatterSetTest.kt
M collection/collection/template/ObjectPValueMap.kt.template
M collection/collection/template/ObjectPValueMapTest.kt.template
M collection/collection/template/PKeyObjectMap.kt.template
M collection/collection/template/PKeyObjectMapTest.kt.template
M collection/collection/template/PKeyPValueMap.kt.template
M collection/collection/template/PKeyPValueMapTest.kt.template
M collection/collection/template/PKeySet.kt.template
M collection/collection/template/PKeySetTest.kt.template
as...@google.com <as...@google.com> #19
Hey, the issue should be fixed now and I will cherry-pick it to the next beta/rc release.
You can test it with the latest snapshot build following instructions at
ro...@gmail.com <ro...@gmail.com> #20
Thanks! Hopefully I won't encounter any additional bugs. I'll wait for the next Beta to come out. If you can let me know in which Beta it will arrive, that would be nice. Any idea how long that will take?
as...@google.com <as...@google.com> #21
Quick note, this won't be included in the next beta since we need to release a stable collection artifact first. I cherry-picked this change into collections 1.4.1 which should be released within next few weeks.
ro...@gmail.com <ro...@gmail.com> #22
Thank you for the update. Just let me know when it's there for me to test.
na...@google.com <na...@google.com> #23
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.collection:collection:1.4.1
androidx.collection:collection-iosarm64:1.4.1
androidx.collection:collection-iossimulatorarm64:1.4.1
androidx.collection:collection-iosx64:1.4.1
androidx.collection:collection-jvm:1.4.1
androidx.collection:collection-linuxx64:1.4.1
androidx.collection:collection-macosarm64:1.4.1
androidx.collection:collection-macosx64:1.4.1
ro...@gmail.com <ro...@gmail.com> #24
Hi, thank you for the update. I've checked, but this is not a dependency I have in my build.gradle.kts file. Is it something I can test?
as...@google.com <as...@google.com> #25
Hi, this is a transitive dependency from runtime, so you can add version 1.4.1
to your dependency list if you want to test.
ro...@gmail.com <ro...@gmail.com> #26
Hi, thank you for your explanation. I've included the 1.4.1 release to the dependency list and I need to test it. I'm away for a few days and this takes some time (at least 82 hours of running, with me present). So I think I can come back to you within 3 weeks tops, maybe sooner.
ro...@gmail.com <ro...@gmail.com> #27
After running my App for more than 1,5 week without any crashes, the issue seems to be fixed! Thank you for the efforts.
pr...@google.com <pr...@google.com> #28
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.collection:collection:1.5.0-alpha01
androidx.collection:collection-iosarm64:1.5.0-alpha01
androidx.collection:collection-iossimulatorarm64:1.5.0-alpha01
androidx.collection:collection-iosx64:1.5.0-alpha01
androidx.collection:collection-jvm:1.5.0-alpha01
androidx.collection:collection-linuxarm64:1.5.0-alpha01
androidx.collection:collection-linuxx64:1.5.0-alpha01
androidx.collection:collection-macosarm64:1.5.0-alpha01
androidx.collection:collection-macosx64:1.5.0-alpha01
androidx.collection:collection-tvosarm64:1.5.0-alpha01
androidx.collection:collection-tvossimulatorarm64:1.5.0-alpha01
androidx.collection:collection-tvosx64:1.5.0-alpha01
androidx.collection:collection-watchosarm32:1.5.0-alpha01
androidx.collection:collection-watchosarm64:1.5.0-alpha01
androidx.collection:collection-watchossimulatorarm64:1.5.0-alpha01
androidx.collection:collection-watchosx64:1.5.0-alpha01
ro...@gmail.com <ro...@gmail.com> #29
Just wanted to let you know that after some long testing I come to the conclusion that if I don't include the transitive dependency mentioned below, the crash still occurs after approx. 82 hours.
implementation("androidx.collection:collection-ktx:1.4.3")
as...@google.com <as...@google.com> #30
Yes, this is a known issue, the dependency was not picked up by 1.7 release branch.
po...@gmail.com <po...@gmail.com> #31
Hello, when will this be released if it wasn't picked up by 1.7 branch but it is marked as fixed?
as...@google.com <as...@google.com> #32
The bug was in collections, and it should be available in the latest stable release
Compose will depend on the newer version starting from 1.8.
Description
Component used: TV
Version used: Android 12
Devices/Android versions reproduced on: Google Chromecast HD (happens on 2 devices simultaniously)
Please also review fixed bug: https://issuetracker.google.com/issues/319855778
Now that this is fixed, this new bug appears. After running the App on the TV for approx. 82 hours (3,5 days) it crashes with the stacklog below. This can be repeated. The App is just displaying some texts and is basically idle for the whole time. There is also an icon displayed that optionally an animated icon. This animated icon is not visible while idle (during these 3,5 days).
Maybe it has something to do with these lines of code?
But as you can see is that the runAnimIconPainters are not visible while the App is idle (not started). The ic_run_anim.xml is an animated-vector icon.
The previous bug was due to a memory leak in the compose libraries, this seems to be a similar issue?