New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 687705 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Strictmode violation on startup

Project Member Reported by rouslan@chromium.org, Feb 1 2017

Issue description

Chrome Version: http://crrev.com/90f8c4f5e2910ec5521012eda89dca55e6cdf26f
OS: Android 7.1.2

What steps will reproduce the problem?
(1) GN flags:
        dcheck_always_on = true
        is_component_build = true
        is_debug = true
        is_clang = true
        target_os = "android"
        disable_incremental_isolated_processes = true
        enable_incremental_javac = true
        symbol_level = 1
(2) Run chromium_public_apk_incremental.

What is the expected result?
No strictmode violations.

What happens instead?
Strictmode violation due to a disk read on UI thread.

Please use labels and text to provide additional information.

02-01 16:22:29.101 18612 18612 D StrictMode: StrictMode policy violation; ~duration=53 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=18153503 violation=2
02-01 16:22:29.101 18612 18612 D StrictMode:    at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1293)
02-01 16:22:29.101 18612 18612 D StrictMode:    at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:249)
02-01 16:22:29.101 18612 18612 D StrictMode:    at java.io.File.exists(File.java:780)
02-01 16:22:29.101 18612 18612 D StrictMode:    at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:512)
02-01 16:22:29.101 18612 18612 D StrictMode:    at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:468)
02-01 16:22:29.101 18612 18612 D StrictMode:    at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:627)
02-01 16:22:29.101 18612 18612 D StrictMode:    at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:345)
02-01 16:22:29.101 18612 18612 D StrictMode:    at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:164)
02-01 16:22:29.101 18612 18612 D StrictMode:    at org.chromium.chrome.browser.download.DownloadManagerService.getAutoRetryCountSharedPreference(DownloadManagerService.java:1692)
02-01 16:22:29.101 18612 18612 D StrictMode:    at org.chromium.chrome.browser.download.DownloadManagerService.<init>(DownloadManagerService.java:262)
02-01 16:22:29.101 18612 18612 D StrictMode:    at org.chromium.chrome.browser.download.DownloadManagerService.getDownloadManagerService(DownloadManagerService.java:218)
02-01 16:22:29.101 18612 18612 D StrictMode:    at org.chromium.chrome.browser.ChromeActivity.finishNativeInitialization(ChromeActivity.java:1095)
02-01 16:22:29.101 18612 18612 D StrictMode:    at org.chromium.chrome.browser.ChromeTabbedActivity.finishNativeInitialization(ChromeTabbedActivity.java:416)
02-01 16:22:29.101 18612 18612 D StrictMode:    at org.chromium.chrome.browser.init.ChromeBrowserInitializer$8.initFunction(ChromeBrowserInitializer.java:306)
02-01 16:22:29.101 18612 18612 D StrictMode:    at org.chromium.chrome.browser.init.ChromeBrowserInitializer$1NativeInitTask.run(ChromeBrowserInitializer.java:236)
02-01 16:22:29.101 18612 18612 D StrictMode:    at android.os.Handler.handleCallback(Handler.java:751)
02-01 16:22:29.101 18612 18612 D StrictMode:    at android.os.Handler.dispatchMessage(Handler.java:95)
02-01 16:22:29.101 18612 18612 D StrictMode:    at android.os.Looper.loop(Looper.java:154)
02-01 16:22:29.101 18612 18612 D StrictMode:    at android.app.ActivityThread.main(ActivityThread.java:6119)
02-01 16:22:29.101 18612 18612 D StrictMode:    at java.lang.reflect.Method.invoke(Native Method)
02-01 16:22:29.101 18612 18612 D StrictMode:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
02-01 16:22:29.101 18612 18612 D StrictMode:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
02-01 16:22:29.101 18612 18612 D AndroidRuntime: Shutting down VM

org.chromium.chrome.browser.download.DownloadManagerService.getAutoRetryCountSharedPreference() should use Android's built-in AsyncTask when calling android.content.ContextWrapper.getSharedPreferences() to avoid disk read on UI thread.
 
We should probably get some CQ bots to run with strictmode enabled :-)
Cc: -dfalcant...@chromium.org
Owner: qin...@chromium.org
Status: Assigned (was: Untriaged)
Cc: wnwen@chromium.org
Could've sworn that the bots did, actually.  IIRC there were CLs that just couldn't land because their new tests kept causing strictmode violations.
Suspecting http://crrev.com/2648323012

Comment 5 by wnwen@chromium.org, Feb 1 2017

Hmm... the only bot that I can recall which explicitly avoids StrictMode is the N bot.
I am reverting that CL now

Comment 7 by wnwen@chromium.org, Feb 1 2017

Thanks for finding the CL, Rouslan.

@qinmin - That CL's method of warm-up succeeds for <N, but on N it triggers a StrictMode violation. See ChromeBrowserInitializer#warmUpSharedPrefs().
Status: Fixed (was: Assigned)

Sign in to add a comment