Search code examples
dockersqliteservercolmap

How to fix SQLite3 disk I/O error when running inside docker container on a server?


I have build an image (details) to run colmap on a server. When running colmap inside the container with a mounted file system I get SQLite error [../src/base/database.cc, line 267]: disk I/O error. The problem seems to be caused by SQLite3 being unable to write to the underlying file system. I have ruled out the following options:

  1. The file system is not corrupted and there is enough free disk space.
  2. The folder is mounted correctly, I can read and create other files.
  3. Other programs are not working with the database (the file is first created during the process).
  4. Using a different location / path structure does not solve the problem.

In this thread it is mentioned that the shared drive arrangement (on the server side) or system resources could cause the problem. I have ruled out resource issues. How can I check whether the shared drive arrangement is actually the problem? How can I make changes such that SQLite3 works as intended?


Solution

  • I just experienced this same problem on my own project. I had checked all of the same datapoints you enumerated. I was running a sqlite3 database (ver 3.7.17) inside a docker container with a read-only database defined by a docker-compose file.

    In my project, I have WAL (Write Ahead Logging) enabled. This requires creation of a WAL file for all database operations. The disk I/O error I was receiving was being caused by sqlite3 being unable to write a WAL file for entries. See link below for more information:

    https://www.sqlite.org/wal.html#read_only_databases

    It appears in ver version 3.22.0 onwards, they made it possible to enable WAL with a read-only filesystem. But my version of sqlite3 wasn't new enough, so my solution ended up being to make the filesystem internal to the container not read-only.