New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StrictMode violations on initialization #580
Comments
@shaishavgandhi05 Thanks for reaching out.
From our side we made sure we read the disk only for preference operations. Do you think this help to mitigate the concern? |
While I agree, you can see that those are three StrictMode violations on a single With new Play Store rankings depending a lot on performance metrics (including app start times), you can see why this might be a concern. |
@shaishavgandhi05 We tested and confirmed that the disk read is not taking this much time even though it shows in the strict mode violation. Definitely we will add optimization in the next version to reduce the disk read on start up |
Sounds good! Thanks! |
Any updates on this? We're facing the same issue and on old devices it often adds several 100ms to to the startup time. Can't you run the I/O in a background thread and then use callbacks to the UI thread? Anything we can assist with to implement that? |
Any updates on this? we are also facing the same issue |
Same problem here. This issue should be reopened. |
Jira Ticket Filed: |
This is still a problem. In our case we're seeing a ~200ms delay due to disk reads in |
Hi @Turnsole, we will be investigating further this sprint. We will keep this thread up to date with our findings and conclusions. |
Calling
Branch.getAutoInstance(context)
during app start causes multiple StrictMode violations (all DiskReadViolations). Here's the logs:2018-05-18 09:53:44.589 6898-6898/com.glassdoor.app D/StrictMode: StrictMode policy violation; ~duration=164 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=1114175 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1440) at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:251) at java.io.File.exists(File.java:807) at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:572) at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:563) at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:519) at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:714) at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:368) at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167) at io.branch.referral.PrefHelper.<init>(PrefHelper.java:154) at io.branch.referral.PrefHelper.getInstance(PrefHelper.java:172) at io.branch.referral.Branch.<init>(Branch.java:424) at io.branch.referral.Branch.initInstance(Branch.java:744) at io.branch.referral.Branch.getBranchInstance(Branch.java:565) at io.branch.referral.Branch.getAutoInstance(Branch.java:645) at com.glassdoor.gdandroid2.app.GDApplication.initBranch(GDApplication.java:540) at com.glassdoor.gdandroid2.app.GDApplication.onCreate(GDApplication.java:312) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
2018-05-18 09:53:44.590 6898-6898/com.glassdoor.app D/StrictMode: StrictMode policy violation; ~duration=136 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=1114175 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1440) at java.io.UnixFileSystem.checkAccess(UnixFileSystem.java:251) at java.io.File.exists(File.java:807) at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:572) at android.app.ContextImpl.ensurePrivateDirExists(ContextImpl.java:563) at android.app.ContextImpl.getPreferencesDir(ContextImpl.java:519) at android.app.ContextImpl.getSharedPreferencesPath(ContextImpl.java:714) at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:368) at android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167) at io.branch.referral.ServerRequestQueue.<init>(ServerRequestQueue.java:61) at io.branch.referral.ServerRequestQueue.getInstance(ServerRequestQueue.java:46) at io.branch.referral.Branch.<init>(Branch.java:427) at io.branch.referral.Branch.initInstance(Branch.java:744) at io.branch.referral.Branch.getBranchInstance(Branch.java:565) at io.branch.referral.Branch.getAutoInstance(Branch.java:645) at com.glassdoor.gdandroid2.app.GDApplication.initBranch(GDApplication.java:540) at com.glassdoor.gdandroid2.app.GDApplication.onCreate(GDApplication.java:312) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
2018-05-18 09:44:50.363 6173-6173/? D/StrictMode: StrictMode policy violation; ~duration=129 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=1114175 violation=2 at android.os.StrictMode$AndroidBlockGuardPolicy.onReadFromDisk(StrictMode.java:1440) at android.app.SharedPreferencesImpl.awaitLoadedLocked(SharedPreferencesImpl.java:234) at android.app.SharedPreferencesImpl.edit(SharedPreferencesImpl.java:315) at io.branch.referral.ServerRequestQueue.<init>(ServerRequestQueue.java:62) at io.branch.referral.ServerRequestQueue.getInstance(ServerRequestQueue.java:46) at io.branch.referral.Branch.<init>(Branch.java:427) at io.branch.referral.Branch.initInstance(Branch.java:744) at io.branch.referral.Branch.getBranchInstance(Branch.java:565) at io.branch.referral.Branch.getAutoInstance(Branch.java:645) at com.glassdoor.gdandroid2.app.GDApplication.initBranch(GDApplication.java:540) at com.glassdoor.gdandroid2.app.GDApplication.onCreate(GDApplication.java:312) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740) at android.app.ActivityThread.-wrap1(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6494) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
The text was updated successfully, but these errors were encountered: