Vinoth M
Vinoth M

Reputation: 1

SQLITE 522 SQLITE IOERR SHORT READ

I got this error every time. How can I solve this issue. I got this error Honeywell EDA51K device.

android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 522 SQLITE_IOERR_SHORT_READ)

Am trying to solve this error for android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 522 SQLITE_IOERR_SHORT_READ)

Anyone help this.

Upvotes: -2

Views: 265

Answers (1)

MikeT
MikeT

Reputation: 57053

How can I solve this issue.

You really need to look into what is happening on the actual device. It is without doubt something specific to that device's operating system has the message is due to the VFS (virtual filing system), which is basically the operating system, not being able to read the requested number of bytes.

As per (522) SQLITE_IOERR_SHORT_READ

If you have access/ability to run the app on the actual device from android studio, you may have some luck in determining what is happening by adding breakpoints and running in debug mode.

Additionally, although perhaps quite complicated, there is the possibility that you could turn on the vfstrace which logs VFS call message. See https://www.sqlite.org/vfs.html

One thing that may be worth investigating is the actual database file(s). If you can copy the database from the device in question (again you could if you have the ability to attach/use the device in Android Studio). You could then open the actual database file in an SQLite tool, perhaps doing so would result in the same issue. If so perhaps the culprit is that by default later Android version use WAL (Write-Ahead Logging), in which case if the WAL file isn't copied then the short read could be a result as the WAL file (database file suffixed with -wal) contain part of the database that hasn't been written to the actual/main database file.

If so then perhaps you are allowing the App to backup and restore the database file but are not also backing up the -wal file and thus only partially restoring the database.

Perhaps the device, at the time of the failure, has exhausted the available memory and thus the short read is a result of insufficient memory to perform the read.

Upvotes: 0

Related Questions