SQLite Forum

Title: disk I/O error
Login

Title: disk I/O error

(1) By Motti Tiefenbrun (mottit) on 2022-08-14 07:26:18 [source]

Hi,

My program is iterating over Sqlite results. The following error is received: "SQLite error code: 10, errstr: disk I/O error". It was received for the statement: "SELECT count(*) FROM sqlite_master WHERE type = "'table' AND name = 'MetaPropDefintions';

What can be the reason for such an error?

Thanks, Motti

(2) By Chris Locke (chrisjlocke1) on 2022-08-14 09:14:56 in reply to 1 [link] [source]

An error reading from the disk?

Is it a local database, or on a network? Removable disk or normal HDD? Have you performed any disk checks? Have you performed a database integrity check?

(3) By Simon Slavin (slavin) on 2022-08-14 12:10:48 in reply to 1 [link] [source]

This is what SQLite returns when it gets a hardware error while trying to do something. It could indicate a bad sector in your drive, and that's very likely if it always happens in the same place in your program, and only in that place.

  • Try executing the same command in the SQLite command-line program.
  • Try duplicating the file and having your program open the duplicate instead of the original.
  • Try using the disk scanning utility of your OS to check your drive for sector errors.

(4) By Larry Brasfield (larrybr) on 2022-08-14 15:47:32 in reply to 1 [link] [source]

The most likely reason (as others have suggested) is that there was an I/O error during your program's iteration when the SQLite library called into the OS to access whatever I/O device the DB is stored on.

Is there some reason that you suspect other reasons, or wish to rule them out?

Did you read the most readily found documentation for that error? If not, why not? Or, if so, what was unclear about it? Or, if it is clear, why do you suspect it to be incomplete?

There are many other possibilities but they are unlikely and generally irrepeatable. For example, you might be running on a system with dynamic memory that has no error correction and had a return from that OS call stored on the stack (in memory) during an interrupt or task switch where one of its bits was flipped due to a cosmic ray that began traveling many years ago. Then, upon return from the interrupt or to your task, an error code was retrieved where a success code had been stored.

You will never know what the real cause was unless you find that it actually was a repeatable or at least reoccurring I/O error.