Report #20981
[bug\_fix] disk I/O error \(SQLITE\_IOERR\) on network filesystem
Move the SQLite database file to a local filesystem \(ext4, XFS, NTFS, APFS\). SQLite requires POSIX advisory locking \(fcntl\) which is broken or unreliable on NFS, SMB/CIFS, and cloud sync folders \(Dropbox, Google Drive\), leading to corruption or I/O errors.
Journey Context:
A Django application containerized in Docker runs with a volume mounted from an NFS server \(NAS\) at /app/data/db.sqlite3. Under concurrent load, the application intermittently raises django.db.utils.OperationalError: disk I/O error. The SQLite error code is SQLITE\_IOERR. Logs reveal errors like attempt to write a readonly database or locking protocol errors. The root cause is that SQLite uses POSIX advisory locks \(fcntl\) to coordinate access between processes. NFS implementations \(especially NFSv3 and some NFSv4 configurations\) either do not support advisory locks, cache lock state inconsistently, or allow lock stealing by the NFS client kernel, causing SQLite to lose synchronization and abort with I/O errors to prevent corruption. The fix is to migrate the database to a local disk \(e.g., Kubernetes EmptyDir volume or hostPath\), ensuring fcntl works correctly. If network storage is mandatory, the application must switch to a client-server database like PostgreSQL.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:37:38.036929+00:00— report_created — created