我在Android O上并使用Room数据库,有时会遇到SQLiteDisckIOException
,我尝试解决问题,但是堆栈并没有告诉我故障点在哪里。可以给我一些提示或如何解决此类问题,这里可能存在什么问题?我正在编写的应用程序将在位置更改时写入数据库,并且还有一些后台任务,可在需要时定期更新数据库。
这是我看到的堆栈:
10-07 22:29:41.404 22214-22226/? E/DataBuffer: Internal data leak within a DataBuffer object detected! Be sure to explicitly call release() on all DataBuffer extending objects when you are done with them. (internal object: com.google.android.gms.common.data.DataHolder@b0fef92)
10-07 22:29:41.405 22214-22226/? E/DataBuffer: Internal data leak within a DataBuffer object detected! Be sure to explicitly call release() on all DataBuffer extending objects when you are done with them. (internal object: com.google.android.gms.common.data.DataHolder@db3ad63)
10-07 22:29:41.415 19847-19847/com.firsapp.testing E/Periodic: from PIM->onCreateOptionMenu
10-07 22:29:41.442 19847-21824/com.firsapp.testing E/SQLiteLog: (522) statement aborts at 7: [SELECT DISTINCT tag FROM worktag WHERE work_spec_id=?] disk I/O error
10-07 22:29:41.443 19847-21824/com.firsapp.testing E/SQLiteQuery: exception: disk I/O error (code 522 SQLITE_IOERR_SHORT_READ); query: SELECT DISTINCT tag FROM worktag WHERE work_spec_id=?
10-07 22:29:41.449 19847-21824/com.firsapp.testing E/AndroidRuntime: FATAL EXCEPTION: pool-6-thread-2
Process: com.firsapp.testing, PID: 19847
android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 522 SQLITE_IOERR_SHORT_READ)
at android.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow(Native Method)
at android.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:859)
at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:836)
at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:149)
at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:137)
at androidx.work.impl.model.WorkTagDao_Impl.getTagsForWorkSpecId(WorkTagDao_Impl.java:92)
at androidx.work.impl.WorkerWrapper.run(WorkerWrapper.java:102)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:764)
10-07 22:29:41.579 890-890/? E/lowmemorykiller: Error writing /proc/19847/oom_score_adj; errno=22
答案 0 :(得分:0)
在SQLite文档SQLITE_IOERR_SHORT_READ
中,是指数据库无法从文件系统读取请求的字节数的情况。
https://www.sqlite.org/rescode.html#ioerr_short_read
是否允许将应用程序安装在外部存储目录中? https://developer.android.com/guide/topics/manifest/manifest-element.html#install
我的猜测是: