Skip to content
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

[Android] isRTLForced StrictMode violation on cold app start #22414

Closed
3 tasks done
romtsn opened this issue Nov 26, 2018 · 1 comment
Closed
3 tasks done

[Android] isRTLForced StrictMode violation on cold app start #22414

romtsn opened this issue Nov 26, 2018 · 1 comment
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.

Comments

@romtsn
Copy link

romtsn commented Nov 26, 2018

Environment

OS: macOS 10.14
Node: 8.12.0
Yarn: 1.10.1
npm: 6.4.1
Watchman: 4.9.0
Xcode: Xcode 10.0 Build version 10A255
Android Studio: 3.2 AI-181.5540.7.32.5014246

Packages: (wanted => installed)
react: 16.6.1 => 16.6.1
react-native: 0.57.5 => 0.57.5

Description

We're having this violation every time when we cold start our app

StrictMode: StrictMode policy violation; ~duration=4094 ms: android.os.StrictMode$StrictModeDiskReadViolation: policy=65599 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 android.content.ContextWrapper.getSharedPreferences(ContextWrapper.java:167)
at com.facebook.react.modules.i18nmanager.I18nUtil.isPrefSet(I18nUtil.java:97)
at com.facebook.react.modules.i18nmanager.I18nUtil.isRTLForced(I18nUtil.java:81)
at com.facebook.react.modules.i18nmanager.I18nUtil.isRTL(I18nUtil.java:48)
at com.facebook.react.uimanager.UIImplementation.createRootShadowNode(UIImplementation.java:122)
at com.facebook.react.uimanager.UIImplementation.registerRootView(UIImplementation.java:200)
at com.facebook.react.uimanager.UIManagerModule.addRootView(UIManagerModule.java:311)
at com.facebook.react.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1037)
at com.facebook.react.ReactInstanceManager.attachRootView(ReactInstanceManager.java:752)
at com.facebook.react.ReactRootView.attachToReactInstanceManager(ReactRootView.java:444)
at com.facebook.react.ReactRootView.startReactApplication(ReactRootView.java:300)

I'm not entirely sure why does it take that long to access SharedPreferences instance, might be due to a big SharedPrefs file. Would it be possible to somehow move it off the main thread?

Thanks!

@Salakar
Copy link
Contributor

Salakar commented Mar 19, 2019

Hey @rom4ek 👋

Thanks for taking the time to create this issue. This issue doesn't have a repro (which means, a react-native init-ed project with the minimal changes that leads to creating the same issue you are reporting). Unfortunately, I have no way of helping you in a meaningful way – there is no easy way for me to recreate the situation and check that the issue reported is still there when changing the code.

I'm not sure why this prefs file would take that long to read and as far as I can tell I don't think it's a file size issue; looking at the source this is a limited prefs file for a small number of items.

Because of this, we are going to close this issue - but if a repro is shared, we are happy to reopen it 🤗

@Salakar Salakar closed this as completed Mar 19, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: Android Android applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

4 participants