Fixed
Status Update
Comments
cc...@google.com <cc...@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
cs...@supercharge.io <cs...@supercharge.io> #3
yea i'll take it.
ap...@google.com <ap...@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.
na...@google.com <na...@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()
}
}
Description
Component used: Macrobenchmark
Version used: 1.2.0-alpha06
Devices/Android versions reproduced on: Pixel 6 Android 13
When having a benchmark with multiple
@Test
functions, it seems that the finalbenchmarkData.json
file only contains one benchmark result in thebenchmarks
JSON array.This can be reproduced with the code taken from the Baseline profile documentation .
Digging in to the benchmark sources, this should work on a first look, because ResultWriter is global
object
, and collects all the previous benchmark results in a list. However this is not working, because each@Test
function seems to be running in a different process, therefore the previous result is lost from theResultWriter
.