Status Update
Comments
ra...@google.com <ra...@google.com>
bo...@google.com <bo...@google.com> #2
Saw this as well on Mokey running recent tot master build.
First benchmark only shows jit happening
Benchmark in the middle of the suite shows it
I verified during the run that the platform still considers the app compiled:
> adb shell dumpsys package dexopt | grep -A1 androidx.compose.ui.benchmark.test
[androidx.compose.ui.benchmark.test]
path: /data/app/~~E9h-5MtFh1GXjXCq3kQo8g==/androidx.compose.ui.benchmark.test-jOZKJEy6zBL_SpFBJqlisA==/base.apk
arm64: [status=speed] [reason=cmdline] [primary-abi]
[location is /data/app/~~E9h-5MtFh1GXjXCq3kQo8g==/androidx.compose.ui.benchmark.test-jOZKJEy6zBL_SpFBJqlisA==/oat/arm64/base.odex]
Disabling method tracing works around this issue, but we don't seem to see it
My guess is that when turning off method tracing, something fails to be cleaned up, and we don't get to keep using the odex/art files from the speed compilation.
lb...@gmail.com <lb...@gmail.com> #3
Appears to be an ART regression starting in API 34
Bramble, API 33
google/bramble/bramble:13/TQ3A.230705.001/10216780:userdebug/dev-keys
112,994 ns Trace Method Trace ModifiersBenchmark.baseReuse[Modifier_10x]
129,934 ns Trace Method Trace ModifiersBenchmark.fullReuse[Modifier_10x]
Bramble, API 34
google/bramble/bramble:14/UP1A.231005.007/10754064:userdebug/dev-keys
77,300 ns Trace Method Trace ModifiersBenchmark.baseReuse[Modifier_10x]
395,151 ns Trace Method Trace ModifiersBenchmark.fullReuse[Modifier_10x]
Will disable method tracing by default on API 34, and file a bug to ART.
bo...@google.com <bo...@google.com> #4
Filed art bug here:
lb...@gmail.com <lb...@gmail.com> #5
Branch: androidx-main
commit 274ff7860d569477ba45d2d48c73bce4a62241ad
Author: Chris Craik <ccraik@google.com>
Date: Thu Oct 05 13:59:01 2023
Disable method tracing by default on API 34+
Bug:303660864
Bug:303686344
Test: ./gradlew bench:b-c:cC
Test: ModifiersBenchmark # on API 33, 34
Method tracing resets compilation state, which doesn't recover on API 34.
Changing method tracing to be off by default while we investigate this.
Change-Id: I568fc7a8a1029250df183bd65baa6b360cd105d5
M benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/BenchmarkStateTest.kt
M benchmark/benchmark-common/src/main/java/androidx/benchmark/Arguments.kt
an...@gmail.com <an...@gmail.com> #6
Thanks for the quick response, Chris!
jm...@google.com <jm...@google.com>
dr...@gmail.com <dr...@gmail.com> #7
Chuck reported this same issue today, where another new benchmark being added was performing far worse on runs after the first, this time on Sargo API 31.
Inspecting the trace showed that the
Chuck's repro device:
google/sargo/sargo:12/SQ1A.220205.002/8010174:userdebug/dev-keys
package:com.google.android.art versionCode:341010052
My device that didn't repro:
google/bramble/bramble:12/SQ1A.220205.002/8010174:userdebug/dev-keys
package:com.google.android.art versionCode:310924000
The reason I'd not been reproducing this bug generally was because I test on devices not connected to wifi. Chuck had a connected device (for adb over wifi), and had received a mainline update I hadn't been seeing in my previous experiments with the bug, where I tested on both api 33 and api 34. API 34 exhibits the bug without a mainline update, but anything 31+ can exhibit the bug.
For now, I'll turn off method tracing by default on API 31+ to be safe.
In the future, we'll look at something based more specifically on mainline versions, and bundling mainline updates with the fix (once available) into the library or gradle plugin, but we can't make it transparent locally, as mainline updates require a reboot.
na...@cybercom.com <na...@cybercom.com> #8
Branch: androidx-main
commit 6ae6408d8845038d1982cfc26b282939fdcebf18
Author: Chris Craik <ccraik@google.com>
Date: Mon Dec 04 16:30:20 2023
Disable method tracing by default on API 31+
Bug: 303660864
Bug: 303686344
Test: Compose benchmarks with multiple ART mainline versions
As the method tracing bug known to affect API 34 has been backported
to older releases via mainline updates, conservatively avoid method
tracing by default on all potentially affected devices (Android 12+).
Ideally we'd check against the versions known to cause the regression,
this is the simpler immediate fix.
Change-Id: I6b01006fc48e9d3bdec99ed2c22b5d424ae7e492
M benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/BenchmarkStateTest.kt
M benchmark/benchmark-common/src/main/java/androidx/benchmark/Arguments.kt
sa...@gmail.com <sa...@gmail.com> #9
@chris is this bug fixed?
da...@gmail.com <da...@gmail.com> #10
Branch: androidx-main
commit d592fecfc81fc38de896124a34d75a1b78da3d7f
Author: Chris Craik <ccraik@google.com>
Date: Mon Dec 11 10:31:13 2023
Disable method tracing by default, everywhere
Test: VectorBenchmark # API 30
Test: BenchmarkStateTest
Bug: 313868903
Bug: 303660864
We've observed that method tracing regresses performance in subsequent
benchmarks on at least API 29/30 without mainline updates (as they
aren't supported).
This change simply disables method tracing as the default while we
sort out in which situations it's safe to enable it.
Change-Id: I7b86146c22ac2fbfcd47cb64638c684d85161acb
M benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/BenchmarkStateTest.kt
M benchmark/benchmark-common/src/main/java/androidx/benchmark/Arguments.kt
il...@gmail.com <il...@gmail.com> #11
Marking as fixed since the default is now working correctly, filed
na...@docusign.com <na...@docusign.com> #12
Branch: androidx-main
commit 625c86746fb820045d8dca4180f4d880b4b0492b
Author: Chris Craik <ccraik@google.com>
Date: Wed Jan 17 17:02:28 2024
Set upper bound for method tracing workaround
Bug:303660864
Test: Verified method tracing still bypassed prior to mainline update
Change-Id: I648793bb789d16edbaec67fa5a0fcd5f51feeeb1
M benchmark/benchmark-common/src/main/java/androidx/benchmark/DeviceInfo.kt
m....@gmail.com <m....@gmail.com> #13
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.benchmark:benchmark-common:1.3.0-alpha01
fe...@gmail.com <fe...@gmail.com> #14
This isn't fully addressed - we noticed that the error for measurement after method tracing isn't on by default, working on a CL for that.
sa...@clearquote.io <sa...@clearquote.io> #15
Branch: androidx-main
commit 8f4d7d8e380dd1e374328fd5535f6d932e71b879
Author: Chris Craik <ccraik@google.com>
Date: Fri May 10 11:38:14 2024
Throw if measuments taken after method trace discards aot
Fixes: 303660864
Test: Ran SampleCustomBenchmark variant with 2 method traces sequentially, throw observed (mokey 34)
Relnote: "Microbenchmark will now correctly throw to prevent method
tracing from interfering with measurements. This occurs on certain
devices when method tracing is forced on (via instrumentation args or
MicrobenchmarkConfig), and if a measurement is attempted after a
method trace. Affected devices are running API 26-30 or certain ART
mainline module versions affected by this interference, and can be
detected at runtime via
`ProfilerConfig.MethodTracing.affectsMeasurementOnThisDevice`."
Change-Id: Iafb92c47c76bf257c047634b61401d873ce85cc5
M benchmark/benchmark-common/api/current.txt
M benchmark/benchmark-common/api/restricted_current.txt
M benchmark/benchmark-common/src/main/java/androidx/benchmark/BenchmarkState.kt
M benchmark/benchmark-common/src/main/java/androidx/benchmark/ProfilerConfig.kt
M benchmark/benchmark/src/androidTest/java/androidx/benchmark/benchmark/SampleCustomBenchmark.kt
da...@google.com <da...@google.com>
ap...@google.com <ap...@google.com> #16
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.benchmark:benchmark-common:1.3.0-beta01
da...@google.com <da...@google.com>
lb...@gmail.com <lb...@gmail.com> #17
Romain saw this on an API 35 device, reopened the ART bug, and marking this blocked on that.
da...@google.com <da...@google.com> #18
Project: platform/frameworks/support
Branch: androidx-main
Author: Chris Craik <
Link:
Fix method tracing affecting measurements when art built from source on API 34
Expand for full commit details
Fix method tracing affecting measurements when art built from source on API 34
Fixes: 303660864
Test: TrivialKotlinBenchmark (with duplicated benchmark on VP1A.230706.001)
Test: DeviceInfoTest
Change-Id: Ic7cad122150c515779365d6565f1c62c69213f82
Files:
- M
benchmark/benchmark-common/src/androidTest/java/androidx/benchmark/DeviceInfoTest.kt
- M
benchmark/benchmark-common/src/main/java/androidx/benchmark/DeviceInfo.kt
- M
benchmark/benchmark-macro/src/main/java/androidx/benchmark/macro/Metric.kt
Hash: 4774190a430d12b3be4b2f3c8880334e2cf66a51
Date: Tue Jan 21 17:04:10 2025
lb...@gmail.com <lb...@gmail.com> #19
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.benchmark:benchmark-common:1.4.0-alpha07
androidx.benchmark:benchmark-macro:1.4.0-alpha07
da...@google.com <da...@google.com> #20
and as long as it's not, be mentioned on the docs with an explanation of what should be done about it.
I have at least added a warning to the docs for now.
I'll look into the bug you linked.
lb...@gmail.com <lb...@gmail.com> #21
Maybe some way to exclude these files in backup rules?
da...@google.com <da...@google.com> #22
You can see the warning I added in your editor as a documentation comment on the EncryptedFile
and EncryptedSharedPreferences
classes. Those comments get copied into the reference info on the jetpack website:
But I think it would be much better for us to provide an Android backup agent implementation that does the filtering for you.
lb...@gmail.com <lb...@gmail.com> #23
Is it possible using setting it in XML , or only during runtime?
I wonder how to do each. BackupAgent doesn't have many samples at all, not even on Github and StackOverflow...
da...@google.com <da...@google.com> #24
You can definitely accomplish this with XML configuration:
But you can also write a custom backup agent class to do the work at runtime. I will update the documentation later to include a reference XML configuration.
Thanks for your feedback!
lb...@gmail.com <lb...@gmail.com> #25
Does it offer a functionality to tell "for the rest, backup as many files as of these from the list" ? This is useful for semi-cache files, which are important, but not very important.
lb...@gmail.com <lb...@gmail.com> #26
bu...@gmail.com <bu...@gmail.com> #27
pa...@gmail.com <pa...@gmail.com> #28
The issue still persists.
Description
AndroidKeysetManager: keyset not found, will generate a new one
java.io.FileNotFoundException: can't read keyset; the pref value __androidx_security_crypto_encrypted_prefs_value_keyset__ does not exist
at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.readPref(SharedPrefKeysetReader.java:71)
at com.google.crypto.tink.integration.android.SharedPrefKeysetReader.readEncrypted(SharedPrefKeysetReader.java:89)
at com.google.crypto.tink.KeysetHandle.read(KeysetHandle.java:105)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.read(AndroidKeysetManager.java:311)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.readOrGenerateNewKeyset(AndroidKeysetManager.java:287)
at com.google.crypto.tink.integration.android.AndroidKeysetManager$Builder.build(AndroidKeysetManager.java:238)
at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:160)
at androidx.security.crypto.EncryptedSharedPreferences.create(EncryptedSharedPreferences.java:120)
Please avoid this.
It has no way for us to handle it. It isn't something we can do about it.
See attached file to understand how I get the instance. Basically it's:
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
@WorkerThread
private fun getSecuredSharedPreferences(context: Context, fileName: String): SharedPreferences {
val masterKey = MasterKey.Builder(context, MasterKey.DEFAULT_MASTER_KEY_ALIAS).setKeyScheme(MasterKey.KeyScheme.AES256_GCM).build()
return EncryptedSharedPreferences.create(context, fileName, masterKey,
EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)
}