Status Update
Comments
cc...@google.com <cc...@google.com>
ml...@google.com <ml...@google.com> #2
Branch: androidx-master-dev
commit b90079595f33f58fece04026a97faa0d243acdb1
Author: Yuichi Araki <yaraki@google.com>
Date: Wed Sep 18 16:55:49 2019
Change the way to detect mismatch between POJO and query
This fixes cursor mismatch warnings with expandProjection.
Bug: 140759491
Test: QueryMethodProcessorTest
Change-Id: I7659002e5e0d1ef60fc1af2a625c0c36da0664d8
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
M room/compiler/src/test/kotlin/androidx/room/processor/QueryMethodProcessorTest.kt
M room/compiler/src/test/kotlin/androidx/room/testing/TestProcessor.kt
jg...@google.com <jg...@google.com> #3
ml...@google.com <ml...@google.com> #4
Branch: androidx-master-dev
commit bdde5a1a970ddc9007b28de4aa29d60ffa588f08
Author: Yigit Boyar <yboyar@google.com>
Date: Thu Apr 16 16:47:05 2020
Re-factor how errors are dismissed when query is re-written
This CL changes how we handle errors/warnings if query is
re-written.
There was a bug in expandProjection where we would report warnings
for things that Room already fixes automatically (
The solution to that problem (I7659002e5e0d1ef60fc1af2a625c0c36da0664d8)
solved it by deferring validating of columns until after re-write
decision is made. Unfortunately, this required changing PojoRowAdapter
to have a dummy mapping until it is validating, make it hard to use
as it does have a non-null mapping which is not useful.
This CL partially reverts that change and instead rely on the log
deferring logic we have in Context. This way, we don't need to break
the stability of PojoRowAdapter while still having the ability to
drop warnings that room fixes. This will also play nicer when we
have different query re-writing options that can use more information
about the query results.
Bug: 153387066
Bug: 140759491
Test: existing tests pass
Change-Id: I2ec967c763d33d7a3ff02c1a13c6953b460d1e5f
M room/compiler/src/main/kotlin/androidx/room/log/RLog.kt
M room/compiler/src/main/kotlin/androidx/room/processor/QueryMethodProcessor.kt
M room/compiler/src/main/kotlin/androidx/room/solver/TypeAdapterStore.kt
M room/compiler/src/main/kotlin/androidx/room/solver/query/result/PojoRowAdapter.kt
jg...@google.com <jg...@google.com> #5
Maybe we can improve the DAC guidance? Would you be able to help us with this?
ml...@google.com <ml...@google.com>
cc...@google.com <cc...@google.com> #6
implementation("androidx.tracing:tracing-perfetto-binary:<latest-version>")
Jakub, for that DAC doc - doesn't Studio / Macrobench inject that for you? (Assuming you add the dependency to the macrobench test module)
On the macrobench side, we should also clarify the exception to link you to that doc.
ml...@google.com <ml...@google.com> #7
I started a cl/549886754 with the changes.
Studio injects that dependency, but I assume it's only when running system tracing from the Studio profilers. Macrobenchmark doesn't inject it. I haven't tried if it works when you add that dependency to :benchmark module. It would be cool if it worked.
cc...@google.com <cc...@google.com> #8
Macrobenchmark doesn't inject it.
It should, you just have to add it to the macrobench module itself. The goal is to have full tracing work in macrobench and studio without you needing to bundle the binary in your app.
jg...@google.com <jg...@google.com> #9
+1 to what Chris said in
To clarify:
- Macrobenchmark (library) does not depend on
tracing-perfetto-binary
- If an app-specific Macrobenchmark (test module) declares a dependency on
tracing-perfetto-binary
, Macrobenchmark (library) will inject it to the app at the time of tracing
As an example, Compose Macrobenchmark target (an app, so neither library of test module) does not depend on tracing-perfetto-binary:
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/integration-tests/macrobenchmark-target/build.gradle;l=20;drc=02eda44f1d669bcda58a997aebcb90fb113c8f2a
..but its Macrobenchmark (test module) does (indirectly through internal-testutils-macrobenchmark
):
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/integration-tests/macrobenchmark/build.gradle;l=40;drc=d80729fe56e7bfdcab04e9812acba0724d6e15ac https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:testutils/testutils-macrobenchmark/build.gradle;l=28;drc=7717bcc0169cca4a1c54d45b620f0392223c9e90
So, you should not have to do what Compose Wear did here (though it still works as Macrobenchmark knows how to handle it):
ml...@google.com <ml...@google.com> #10
Hey, might there be a bug introduced or some misconfiguration?
Folks in
I tried to verify it and when I have the dependencies in :macrobench, I don't see the full traces in perfetto, but when I add it to target, it crashes with the exception mentioned in the samples.
jg...@google.com <jg...@google.com> #11
Version incompatibility
Regarding:
Process: com.google.samples.apps.nowinandroid.demo.benchmark, PID: 20835
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/tracing/perfetto/Tracing;
at androidx.compose.runtime.tracing.TracingInitializer$create$1.isTraceInProgress(Unknown Source:0)
at coil.util.-Contexts.isTraceInProgress(SourceFile:1)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(SourceFile:3)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(SourceFile:1)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(SourceFile:7)
We've had to do a bunch of API renames in order to move from Alpha -> Beta (we're trying to go to Stable ASAP)
Temporarily (until tomorrow, Aug 23, 2023), this is a safe configuration to use (versions-wise):
androidx.compose.runtime.runtime-tracing-1.0.0-alpha03 # in app (target)
androidx.tracing.tracing-perfetto-1.0.0-alpha11 # in benchmark
androidx.tracing.tracing-perfetto-binary-1.0.0-alpha11 # in benchmark
Apologies for a state of things. We're moving to stable with both Benchmark and Tracing, which will make things easier. And hopefully no more breaking renames.
From tomorrow's Jetpack release:
androidx.compose.runtime.runtime-tracing-1.0.0-alpha04 # in app (target)
androidx.tracing.tracing-perfetto-1.0.0-beta02 # in benchmark
androidx.tracing.tracing-perfetto-binary-1.0.0-beta02 # in benchmark
Easier (maybe) alternative
- Declare a dependency in the target app on androidx.compose.runtime.runtime-tracing
- Check what version of tracing-perfetto it uses through a command below (separate section below)
- Use that version of tracing-perfetto and tracing-perfetto-binary in the benchmark
These might come in handy
Verifying dependencies actually used
./gradlew app:dependencies | grep tracing
Forcing a particular version
implementation("androidx.tracing:tracing-perfetto:1.0.0-alpha11") {
version {
strictly("1.0.0-alpha11")
}
}
di...@target.com <di...@target.com> #12
I have also raised the same issue under Tracing component as the documentation pointed to that:
jg...@google.com <jg...@google.com> #13
Re
di...@target.com <di...@target.com> #14
Phew! Yes, that works now. It looks like maybe some transitive dependency was updating the tracing-perfetto
to 1.0.0-beta01
and hence compose traces were not available. Forcing it to the particular version mentioned fixed the issue. Hoping tomorrow's release do not break anything further!
Suggestion: I know alpha/beta versions are bound to breaking changes, but can we have a section in the documentation which can point out the working approach for scenarios like this and make it easier to adopt? This can also help to identify the last working set and check from there on-wards for breaking changes.
jg...@google.com <jg...@google.com> #15
Makes sense. Apologies for the issue, we try not to leave libraries in a state that requires workarounds in the form of
cc...@google.com <cc...@google.com> #16
Jakub, is there any more we can do here for this release (potentially clarifying in relnotes or error message), or should we close?
jg...@google.com <jg...@google.com> #17
I think a compatibility matrix (compose-runtime-tracing, tracing-perfetto, benchmark) could be too complicated
The simplest I can see is:
- moving to RC/Stable soon (WIP)
- throw an exception (crash) the benchmark when we cannot find the binaries and tell the user what dependency to add and where (CL in progress:
http://aosp/2743602 ) - on DAC, mention that if a user gets the exception: unable to find class androidx.tracing.perfetto.Trace..., they should upgrade compose-runtime-tracing to the latest version
@Chris, @Tomáš, WDYT?
ap...@google.com <ap...@google.com> #18
Branch: androidx-main
commit d9222cd972bae02c71293322bdc641247c19126d
Author: Jakub Gielzak <jgielzak@google.com>
Date: Fri Sep 08 19:14:48 2023
Better handling of Perfetto SDK handshake errors
* Enforces that clients of enableAndroidxTracingPerfetto check the
result of the method
* Throws if enableAndroidxTracingPerfetto fails in PerfettoCapture
Relnote: "An exception (with remedy instructions) is now thrown when
Perfetto SDK tracing fails to initialise in a Benchmark."
Bug: 271466875
Bug: 286228781
Test: PerfettoSdkHandshakeTest
Test: PerfettoSdkOverheadBenchmark
Test: TrivialPerfettoSdkBenchmark
Change-Id: I6c87872507c126bdde3bc476a39baf75cc58c9de
M benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoCapture.kt
M benchmark/benchmark-common/src/main/java/androidx/benchmark/perfetto/PerfettoCaptureWrapper.kt
M benchmark/benchmark-macro/src/androidTest/java/androidx/benchmark/macro/perfetto/PerfettoSdkHandshakeTest.kt
M benchmark/benchmark/src/androidTest/java/androidx/benchmark/benchmark/PerfettoSdkOverheadBenchmark.kt
M compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/TrivialPerfettoSdkBenchmark.kt
cc...@google.com <cc...@google.com> #19
I don't think DAC is a great place to surface the unable to find class error - can we hook the failed classload somehow, can we give a better error message in the target app in some way from within the tracing perfetto library?
ml...@google.com <ml...@google.com> #20
I kind of agree as well DAC is the right place for this. We have some error messages / misconfiguration for Macrobenchmark on DAC around build variants and multi-module setup. But these errors are a good fit, because the libraries can't do it in any away and it's a form of guidance to properly configure your project.
Regarding configuration matrix for dependencies. We're having more and more dependencies that are compatible only with certain versions, maybe it's time to rethink having a compatibility matrix?
You need to have proper versions of:
- AGP
- Macrobenchmark
- Profile Installer
- (potentially) Baseline Profile Gradle Plugin
- (and now) Perfetto
If misconfiguration crashes with some reasonable message (we could ask/answer that on StackOverflow), that SG to me. It's worse when it just doesn't work.
jg...@google.com <jg...@google.com> #21
Crashing with some reasonable message (we could ask/answer that on StackOverflow) is what we now moved to - changes will go out in the next Benchmark+Tracing release.
Both possible crash scenarios described below.
NoClassDefFoundError
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/tracing/perfetto/Tracing;
means the app is using an old version of compose-runtime-tracing. Updating to the latest version fixes the issue.
If we try to detect a failed classload, we'd have to release a newer version with this logic, which defeats the point of the change, as the fix is to simply use a newer version. And since we're now in Beta, the name of the class won't change.
RuntimeException
RuntimeException
: Issue while enabling Perfetto SDK tracing in ${perfettoSdkConfig.targetPackage}: Perfetto SDK binary dependencies missing. Required version: [...] To fix, declare the following dependency [...] will be thrown from the next Benchmark release whenever we fail to resolve tracing-perfetto-binary
in the benchmark. The error message is very descriptive (see
Simplifying the workflow
From the user's perspective, the easiest would be to just use the latest version of compose-runtime-tracing
. I'll try to get it to 1.0.0 stable ASAP to encourage users to upgrade (currently they're using an Alpha). If they need to supply tracing-perfetto-binary
dependency, Benchmark will inform them how to do that (through the RuntimeException described above). Does that sound reasonable?
jg...@google.com <jg...@google.com> #22
I'm going to close the bug as IMO
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.benchmark:benchmark-common:1.2.0-rc01
androidx.benchmark:benchmark-macro:1.2.0-rc01
ml...@google.com <ml...@google.com> #24
Something's wrong, I think.
When I use
androidx.compose.runtime.runtime-tracing-1.0.0-alpha04 # in app (target)
androidx.tracing.tracing-perfetto-1.0.0-rc01 # in benchmark
androidx.tracing.tracing-perfetto-binary-1.0.0-rc01 # in benchmark
androidx.benchmark:benchmark-macro-juni4:1.2.0-rc01 #in benchmark
It fails with
java.lang.RuntimeException: Issue while enabling Perfetto SDK tracing in com.google.composeviewbenchmarks.target: Perfetto SDK binary verification failed. Required version: 1.0.0-beta02. Error: androidx.tracing.perfetto.security.IncorrectChecksumException: Invalid checksum for file: /data/user/0/com.google.composeviewbenchmarks.target/code_cache/libtracing_perfetto.so. Ensure you are using correct version of the library and clear local caches.. If working with an unreleased snapshot, ensure all modules are built against the same snapshot (e.g. clear caches and rebuild).
Should we check only older versions? Or does this need to be an exact version?
Adding
version {
strictly("1.0.0-beta02")
}
resolves the problem
ml...@google.com <ml...@google.com>
jg...@google.com <jg...@google.com> #25
Re strict
keyword is required. This is a separate issue (from what the bug was originally opened for), and since we now track SLO, let's open a new one for new issues instead of reusing this one as a grab-all. For issue from
jg...@google.com <jg...@google.com> #26
(marking as fixed as the original issue was fixed, for
Description
Macrobenchmark 1.2.0-alpha14
androidx.compose.runtime-tracing: 1.0.0-alpha03
Devices/Android versions reproduced on: userdebug Pixel 6 API 33
When using
androidx.benchmark.fullTracing.enable=true
instr argument, the benchmark crashes after the first iteration.I'm running benchmark with
FrameTimingMetric
CompilationMode.Full()
andStartupMode.WARM
. The interactions with the app run correctly, but at the end of the first iteration, it crashes.Reproduced in Now in Android in the separate branch .
Logcat