StrictMode violation on WebView initialization |
||
Issue descriptionThis bug is split out from b/63324842 After removing the StrictMode.allowThreadDiskReads() call in WebViewFactory that surrounds the call into the WebView APK, we hit the following StrictMode violation: AndroidRuntime: FATAL EXCEPTION: main AndroidRuntime: Process: com.android.webviewstrictmodechecker, PID: 5091 AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.webviewstrictmodechecker/com.android.webviewstrictmodechecker.MainActivity}: android.util.AndroidRuntimeException: java.lang.reflect.InvocationTargetException AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2794) AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2870) AndroidRuntime: at android.app.ActivityThread.access$1300(ActivityThread.java:177) AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1599) AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) AndroidRuntime: at android.os.Looper.loop(Looper.java:164) AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6519) AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:816) AndroidRuntime: Caused by: android.util.AndroidRuntimeException: java.lang.reflect.InvocationTargetException AndroidRuntime: at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:211) AndroidRuntime: at android.webkit.WebView.getFactory(WebView.java:2534) AndroidRuntime: at android.webkit.WebView.ensureProviderCreated(WebView.java:2529) AndroidRuntime: at android.webkit.WebView.setOverScrollMode(WebView.java:2594) AndroidRuntime: at android.view.View.<init>(View.java:4651) AndroidRuntime: at android.view.View.<init>(View.java:4783) AndroidRuntime: at android.view.ViewGroup.<init>(ViewGroup.java:597) AndroidRuntime: at android.widget.AbsoluteLayout.<init>(AbsoluteLayout.java:55) AndroidRuntime: at android.webkit.WebView.<init>(WebView.java:639) AndroidRuntime: at android.webkit.WebView.<init>(WebView.java:584) AndroidRuntime: at android.webkit.WebView.<init>(WebView.java:567) AndroidRuntime: at android.webkit.WebView.<init>(WebView.java:554) AndroidRuntime: at android.webkit.WebView.<init>(WebView.java:544) AndroidRuntime: at com.android.webviewstrictmodechecker.MainActivity.onCreate(MainActivity.java:21) AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6991) AndroidRuntime: at android.app.Activity.performCreate(Activity.java:6982) AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2745) AndroidRuntime: ... 9 more AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) AndroidRuntime: at android.webkit.WebViewFactory.getProvider(WebViewFactory.java:206) AndroidRuntime: ... 26 more AndroidRuntime: Caused by: android.os.StrictMode$StrictModeViolation: policy=262207 violation=2 AndroidRuntime: at android.os.StrictMode.executeDeathPenalty(StrictMode.java:1626) AndroidRuntime: at android.os.StrictMode.access$1500(StrictMode.java:115) AndroidRuntime: at android.os.StrictMode$AndroidBlockGuardPolicy.handleViolation(StrictMode.java:1619) AndroidRuntime: at android.os.StrictMode$AndroidBlockGuardPolicy.handleViolationWithTimingAttempt(StrictMode.java:1448) AndroidRuntime: at android.os.StrictMode$AndroidBlockGuardPolicy.startHandlingViolationException(StrictMode.java:1419) AndroidRuntime: at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1388) AndroidRuntime: at java.io.UnixFileSystem.getLength(UnixFileSystem.java:265) AndroidRuntime: at java.io.File.length(File.java:962) AndroidRuntime: at java.util.zip.ZipFile.<init>(ZipFile.java:209) AndroidRuntime: at java.util.zip.ZipFile.<init>(ZipFile.java:149) AndroidRuntime: at java.util.jar.JarFile.<init>(JarFile.java:160) AndroidRuntime: at java.util.jar.JarFile.<init>(JarFile.java:97) AndroidRuntime: at libcore.io.ClassPathURLStreamHandler.<init>(ClassPathURLStreamHandler.java:47) AndroidRuntime: at dalvik.system.DexPathList$NativeLibraryElement.maybeInit(DexPathList.java:761) AndroidRuntime: at dalvik.system.DexPathList$NativeLibraryElement.findNativeLibrary(DexPathList.java:782) AndroidRuntime: at dalvik.system.DexPathList.findLibrary(DexPathList.java:528) AndroidRuntime: at dalvik.system.BaseDexClassLoader.findLibrary(BaseDexClassLoader.java:154) AndroidRuntime: at java.lang.Runtime.loadLibrary0(Runtime.java:1005) AndroidRuntime: at java.lang.System.loadLibrary(System.java:1657) AndroidRuntime: at org.chromium.base.library_loader.LibraryLoader.loadAlreadyLocked(LibraryLoader.java:75) AndroidRuntime: at org.chromium.base.library_loader.LibraryLoader.loadNowOverrideApplicationContext(LibraryLoader.java:27) AndroidRuntime: at com.android.webview.chromium.WebViewChromiumFactoryProvider.initialize(WebViewChromiumFactoryProvider.java:65) AndroidRuntime: at com.android.webview.chromium.WebViewChromiumFactoryProvider.<init>(WebViewChromiumFactoryProvider.java:36) AndroidRuntime: at com.android.webview.chromium.WebViewChromiumFactoryProviderForO.<init>(WebViewChromiumFactoryProviderForO.java:4) AndroidRuntime: at com.android.webview.chromium.WebViewChromiumFactoryProviderForOMR1.<init>(WebViewChromiumFactoryProviderForOMR1.java:5) AndroidRuntime: at com.android.webview.chromium.WebViewChromiumFactoryProviderForOMR1.create(WebViewChromiumFactoryProviderForOMR1.java:1) AndroidRuntime: ... 28 more we should fix this strictmode violation (probably through calling allowThreadDiskReads() in a lower layer), so that we can remove the call from WebViewFactory, and then catch any new Strictmode violations on WebView startup.
,
Oct 3 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/02987e417dd27f311a36f0471570a757c879e821 commit 02987e417dd27f311a36f0471570a757c879e821 Author: Gustav Sennton <gsennton@google.com> Date: Tue Oct 03 15:12:48 2017 [Android WebView] Fix StrictMode violations on WebView startup. Fix a bunch of StrictMode violations on WebView startup related to loading native libraries, and fetching the version of the last WebView loaded. This fix enables us to remove the StrictMode.allowThreadDiskReads() call in android.webkit.WebViewFactory - a call that allows diskReads throughout WebView initialization. Removing that call is useful because doing so allows us to catch any new StrictMode violations - which are often a result of unwanted disk reads/writes on the UI thread). Bug: 769302 Change-Id: Id28966779bac5b512e46f8d33fda1c6293d4f6e5 Reviewed-on: https://chromium-review.googlesource.com/687495 Commit-Queue: Gustav Sennton <gsennton@chromium.org> Reviewed-by: Anthony Berent <aberent@chromium.org> Reviewed-by: Richard Coles <torne@chromium.org> Cr-Commit-Position: refs/heads/master@{#506043} [modify] https://crrev.com/02987e417dd27f311a36f0471570a757c879e821/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java [modify] https://crrev.com/02987e417dd27f311a36f0471570a757c879e821/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
,
Oct 3 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by gsennton@chromium.org
, Sep 27 2017