Skip to content

Failed to open database RKStorage (language) #178

Closed
@Bruno-Furtado

Description

@Bruno-Furtado

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions