mozilla-mobile/fenix

[Bug] Main thread network call on start up: HomeMenu calls getExperimentBranch

Closed this issue · 2 comments

Steps to reproduce

  • Install debug app
  • Start app

Expected behavior

No crash

Actual behavior

Crash

12-07 13:23:27.416 E/AndroidRuntime(29476): Caused by: android.os.strictmode.DiskReadViolation
12-07 13:23:27.416 E/AndroidRuntime(29476): at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1596)
12-07 13:23:27.416 E/AndroidRuntime(29476): at java.io.UnixFileSystem.getLastModifiedTime(UnixFileSystem.java:289)
12-07 13:23:27.416 E/AndroidRuntime(29476): at java.io.File.lastModified(File.java:939)
12-07 13:23:27.416 E/AndroidRuntime(29476): at java.util.zip.ZipFile.(ZipFile.java:265)
12-07 13:23:27.416 E/AndroidRuntime(29476): at java.util.zip.ZipFile.(ZipFile.java:187)
12-07 13:23:27.416 E/AndroidRuntime(29476): at java.util.jar.JarFile.(JarFile.java:169)
12-07 13:23:27.416 E/AndroidRuntime(29476): at java.util.jar.JarFile.(JarFile.java:106)
12-07 13:23:27.416 E/AndroidRuntime(29476): at libcore.io.ClassPathURLStreamHandler.(ClassPathURLStreamHandler.java:46)
...
12-07 13:23:27.416 E/AndroidRuntime(29476): at mozilla.components.concept.fetch.Response$Body.(Response.kt:66)
12-07 13:23:27.416 E/AndroidRuntime(29476): at mozilla.components.browser.engine.gecko.fetch.GeckoViewFetchClientKt.toResponse(GeckoViewFetchClient.kt:118)
12-07 13:23:27.416 E/AndroidRuntime(29476): at mozilla.components.browser.engine.gecko.fetch.GeckoViewFetchClient.fetch(GeckoViewFetchClient.kt:65)
12-07 13:23:27.416 E/AndroidRuntime(29476): at mozilla.appservices.httpconfig.RustHttpConfig.doFetch$httpconfig_release(HttpConfig.kt:81)
12-07 13:23:27.416 E/AndroidRuntime(29476): at mozilla.appservices.httpconfig.CallbackImpl.invoke(HttpConfig.kt:135)
12-07 13:23:27.416 E/AndroidRuntime(29476): at java.lang.reflect.Method.invoke(Native Method)
12-07 13:23:27.416 E/AndroidRuntime(29476): at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:520)
12-07 13:23:27.416 E/AndroidRuntime(29476): at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:551)
12-07 13:23:27.416 E/AndroidRuntime(29476): at com.sun.jna.Native.invokeStructure(Native Method)
12-07 13:23:27.416 E/AndroidRuntime(29476): at com.sun.jna.Native.invokeStructure(Native.java:2102)
12-07 13:23:27.416 E/AndroidRuntime(29476): at com.sun.jna.Function.invoke(Function.java:445)
12-07 13:23:27.416 E/AndroidRuntime(29476): at com.sun.jna.Function.invoke(Function.java:361)
12-07 13:23:27.416 E/AndroidRuntime(29476): at com.sun.jna.Library$Handler.invoke(Library.java:265)
12-07 13:23:27.416 E/AndroidRuntime(29476): at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
12-07 13:23:27.416 E/AndroidRuntime(29476): at $Proxy8.nimbus_1725_NimbusClient_get_experiment_branch(Unknown Source)
12-07 13:23:27.416 E/AndroidRuntime(29476): at org.mozilla.experiments.nimbus.NimbusClient.getExperimentBranch(nimbus.kt:879)
12-07 13:23:27.416 E/AndroidRuntime(29476): at mozilla.components.service.nimbus.Nimbus.getExperimentBranch(Nimbus.kt:171)
12-07 13:23:27.416 E/AndroidRuntime(29476): at org.mozilla.fenix.home.HomeMenu$coreMenuItems$2.invoke(HomeMenu.kt:102)
12-07 13:23:27.416 E/AndroidRuntime(29476): at org.mozilla.fenix.home.HomeMenu$coreMenuItems$2.invoke(HomeMenu.kt:32)
12-07 13:23:27.416 E/AndroidRuntime(29476): at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
12-07 13:23:27.416 E/AndroidRuntime(29476): at org.mozilla.fenix.home.HomeMenu.getCoreMenuItems(Unknown Source:2)
12-07 13:23:27.416 E/AndroidRuntime(29476): at org.mozilla.fenix.home.HomeMenu.(HomeMenu.kt:218)

It seems to indicate it's a disk read violation but it also appears this would do main thread IO because it's accessing GeckoViewFetchClient.

It's very important that we don't do main thread network calls because they can cause users to wait for arbitrary amounts of time. Please find a solution that isn't suppression.

Note: we also crash in Nightly for a related but different reason: because we're unable to reach the server. I filed #16902 for that.

Device information

  • Android device: P2
  • Fenix version: master 948db6f

┆Issue is synchronized with this Jira Task

S1: afaict, all (only new? not sure) users will make a main thread network call, causing delays to start up.

Duping this to #16852 which is also has the perf. label.