question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to open database RKStorage (language)

See original GitHub issue

Current behavior

After changing the device language the app crashs.

Expected behavior

No impact on the app when user changes the device language.

Repro steps

  1. Install a release build using some language, like en_US
  2. Kill the app
  3. Change the device language, for example pt_BR
  4. Open the app
  5. App crashs

Environment

  • Async Storage version: 1.6.1
  • React-Native version: 0.60.4
  • Platform tested: Android
  • Logs/Error that are relevant:
Failed to open database "/data/user/0/com.app/databases/RKStorage".
android.database.sqlite.SQLiteException: Failed to change locale for db "/data/user/0/com.app/databases/RKStorage" to "en_US".
	at android.database.sqlite.SQLiteConnection.setLocaleFromConfiguration(SQLiteConnection.java:394)
	at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:219)
	at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:194)
	at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:493)
	at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:200)
	at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:192)
	at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:864)
	at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:849)
	at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:724)
	at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:714)
	at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:295)
	at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:238)
	at com.facebook.react.modules.storage.ReactDatabaseSupplier.ensureDatabase(ReactDatabaseSupplier.java:88)
	at com.facebook.react.modules.storage.AsyncStorageModule.ensureDatabase(AsyncStorageModule.java:432)
	at com.facebook.react.modules.storage.AsyncStorageModule.access$000(AsyncStorageModule.java:38)
	at com.facebook.react.modules.storage.AsyncStorageModule$1.doInBackgroundGuarded(AsyncStorageModule.java:132)
	at com.facebook.react.modules.storage.AsyncStorageModule$1.doInBackgroundGuarded(AsyncStorageModule.java:129)
	at com.facebook.react.bridge.GuardedAsyncTask.doInBackground(GuardedAsyncTask.java:32)
	at com.facebook.react.bridge.GuardedAsyncTask.doInBackground(GuardedAsyncTask.java:20)
	at android.os.AsyncTask$2.call(AsyncTask.java:333)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at com.facebook.react.modules.storage.AsyncStorageModule$SerialExecutor$1.run(AsyncStorageModule.java:64)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
	at java.lang.Thread.run(Thread.java:764)
Caused by: android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5)
	at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)
	at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:556)
	at android.database.sqlite.SQLiteConnection.setLocaleFromConfiguration(SQLiteConnection.java:385)
	... 24 more   
(1032) statement aborts at 14: [INSERT OR REPLACE INTO catalystLocalStorage VALUES (?, ?);] attempt to write a readonly database
attempt to write a readonly database (code 1032)
android.database.sqlite.SQLiteReadOnlyDatabaseException: attempt to write a readonly database (code 1032)
	at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)
	at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:556)
	at android.database.sqlite.SQLiteSession.execute(SQLiteSession.java:619)
	at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:44)
	at com.reactnativecommunity.asyncstorage.AsyncStorageModule$2.doInBackgroundGuarded(AsyncStorageModule.java:235)
	at com.reactnativecommunity.asyncstorage.AsyncStorageModule$2.doInBackgroundGuarded(AsyncStorageModule.java:205)
	at com.facebook.react.bridge.GuardedAsyncTask.doInBackground(GuardedAsyncTask.java:32)
	at com.facebook.react.bridge.GuardedAsyncTask.doInBackground(GuardedAsyncTask.java:20)
	at android.os.AsyncTask$2.call(AsyncTask.java:333)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at com.reactnativecommunity.asyncstorage.AsyncStorageModule$SerialExecutor$1.run(AsyncStorageModule.java:62)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
	at java.lang.Thread.run(Thread.java:764)
--------- beginning of crash
[ 31506:31506 E/AndroidRuntime ]
FATAL EXCEPTION: main
Process: com.app, PID: 31506
android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:164)
	at android.app.ActivityThread.main(ActivityThread.java:6626)
	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:811)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
eabaitcommented, Oct 25, 2019

Hi folks

I have seen similar errors popping up in our Sentry report.

android.database.sqlite.SQLiteDatabaseLockedException: database is locked (code 5 SQLITE_BUSY[5]): , while compiling: PRAGMA cache_size
    at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)
    at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1229)
    at android.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:797)
    at android.database.sqlite.SQLiteConnection.setCacheSizeFromConfiguration(SQLiteConnection.java:423)
    at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:302)
    at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:215)
    at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:705)
    at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:272)
    at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:239)
    at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:1292)
    at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:1247)
    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:903)
    at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:893)
    at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:365)
    at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:322)
    at com.hoxfon.react.RNTwilioVoice.TwilioVoiceModule.accept(TwilioVoiceModule.java:549)
    at com.hoxfon.react.RNTwilioVoice.TwilioVoiceModule$VoiceBroadcastReceiver.onReceive(TwilioVoiceModule.java:449)
    at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:313)
    at android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:121)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7073)
    at java.lang.reflect.Method.invoke(Method.java)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

Do you know what can we do? Upgrade/downgrade lib version?

2reactions
varungupta85commented, Oct 14, 2019

This error is reported from multiple users on Sentry for my app as well. Error is database is locked (code 5)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to open database RKStorage (language) #178 - GitHub
Current behavior After changing the device language the app crashs. ... Failed to open database RKStorage (language) #178.
Read more >
Where is AsyncStorage Data Physically Located on Android ...
In SQLite Manager go to Database->Connect Database and "open file" window will open there you select All files at bottom of your window...
Read more >
Data Storage on Android - Mobile Security Gitbook
Asking the user to decrypt the database with a PIN or password once the app is opened (weak passwords and PINs are vulnerable...
Read more >
com.amazon.avod.thirdpartyclient_v3.0.219.32341 ...
INTERNET, Allows applications to open network sockets. android.permission. ... Clearing and deleting database RKStorage failed.
Read more >
Language settings in FM file - Claris Community - FileMaker Pro
The only way to escape the curse is, AFAIK, to open the cursed database on the new system, save a clone and start...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found