android x86 disk io,android - SQLiteDiskIOException: disk I/O error (code 1802): , while compiling: ...

I've been having a few crashes that have been coming up more often recently and i cannot figure out how to reproduce them or fix them. Here is the one that comes up most often

Fatal Exception: java.lang.RuntimeException: Unable to create application com.myapp.MyApplication: android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 1802): , while compiling: PRAGMA journal_mode

at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5436)

at android.app.ActivityThread.-wrap2(ActivityThread.java)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1546)

at android.os.Handler.dispatchMessage(Handler.java:102)

at android.os.Looper.loop(Looper.java:154)

at android.app.ActivityThread.main(ActivityThread.java:6154)

at java.lang.reflect.Method.invoke(Method.java)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

Caused by android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 1802): , while compiling: PRAGMA journal_mode

at android.database.sqlite.SQLiteConnection.nativePrepareStatement(SQLiteConnection.java)

at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)

at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:634)

at android.database.sqlite.SQLiteConnection.setJournalMode(SQLiteConnection.java:320)

at android.database.sqlite.SQLiteConnection.setWalModeFromConfiguration(SQLiteConnection.java:294)

at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:215)

at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193)

at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463)

at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185)

at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177)

at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:808)

at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:793)

at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:696)

at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:680)

at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:289)

at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:223)

at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163)

at com.myapp.DBConnect.getInstance(DBConnect.java:202)

at com.myapp.MyApplication.onCreate(MyApplication.java:66)

Every search I try makes it sound like the issue is with trying to open the database from different threads. However, I thought I had a setup to avoid this by having a static method in the helper class to get the current instance.

private static DBConnect mInstance = null;

private static SQLiteDatabase db;

public static DBConnect getInstance(Context ctx) {

if (mInstance == null) {

mInstance = new DBConnect(ctx.getApplicationContext());

db = mInstance.getWritableDatabase(); // this is line 202 in DBConnect.java

// all methods in this class reference this db var to run database queries

}

return mInstance;

}

and then wherever i need to access the database I have a local variable db set by using this line:

// this is line 66 in MyApplication.java

DBConnect db = DBConnect.getInstance(this);

then run all my database queries with functions like db.addItem()

It has been working fine and I am 90% sure multiple threads are accessing the same tables without me ever seeing crashes. The app has a couple lists which sync in the background in several places, the easiest one to reproduce is when the app first launches it performs a sync of these lists. While it is syncing the user can view the different lists, loading each list is selecting its contents from the database, possibly while items are being added or deleted from the same tables in the background sync process. I also have a couple hundred active users a day and have only seen this kind of crash 15 times over the last few months.

Also, seeing that the first line of the error is java.lang.RuntimeException: Unable to create application ..., It seems like this is happening when the user first launches the app? Not sure how there could already be multiple threads at this point, none of the background processes run unless the user has signed in.

I am also seeing the following error caused by the same line:

Failed to change locale for db '/data/user/0/com.myapp/databases/mydb' to 'en_US'.

I have tried changing locale settings on my phone, reinstalling the app and then messing around to see if i get this problem. I even tried switching back to English after installing using another locale but have not been able to repeat this crash. I have a feeling they might be related since they both seem to be happening on startup.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值