Fixed
Status Update
Comments
ja...@google.com <ja...@google.com> #2
Yigit, do you have time to fix it?
reemission of the same liveData is racy
reemission of the same liveData is racy
ma...@textnow.com <ma...@textnow.com> #3
yea i'll take it.
rk...@google.com <rk...@google.com>
je...@google.com <je...@google.com>
ma...@google.com <ma...@google.com> #4
Thanks for the detailed analysis. This may not be an issue anymore since we've started using Main.immediate there but I' not sure; I'll try to create a test case.
ap...@google.com <ap...@google.com> #5
just emitting same live data reproduces the issue.
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
@Test
fun raceTest() {
val subLiveData = MutableLiveData(1)
val subject = liveData(testScope.coroutineContext) {
emitSource(subLiveData)
emitSource(subLiveData) //crashes
}
subject.addObserver().apply {
testScope.advanceUntilIdle()
}
}
ma...@google.com <ma...@google.com>
pr...@google.com <pr...@google.com> #6
With 2.2.0-alpha04 (that use Main.immediate), the issue seems to be still there (I tested it by calling emitSource() twice, like your test case)
Description
STEPS TO REPRODUCE:
1. Use the IDE to auto-generate a baseline profile module
2. Change _ONE_ of the two device references from pixel6 to pixel8, but not both (ie: we would expect an error message, but not this error message)
3. run `./gradlew tasks` and notice that it says it can not determine the test task. This leads devs down a rabbit hole trying to solve the wrong thing. Ideally, it would tell them there is a device mismatch.
Issue is coming from: BaselineProfileProducerPlugin.kt#createTasksForVariant
(I was not able to place this ticket in the correct component)
```
* What went wrong:
A problem occurred configuring project ':baselineprofile'.
> com.android.build.gradle.internal.crash.ExternalApiUsageException: org.gradle.api.GradleException: It wasn't possible to determine the test task for managed device `pixel8Api34`.
Please check the managed devices specified in the baseline profile
configuration.
```
Studio Build: Iguana 2023.2.1 Canary 15
Version of Gradle Plugin: 8.2.0-rc03
Version of Gradle: 8.3-rc-2-all
Version of Java: 17
OS: Ubuntu 22.04.3 LTS x86_64