SQLITE_IOERR_SHMMAPERRORTier 2 — Caution⚠️ MEDIUM confidenceI/O error memory-mapping WAL shared memory
🔴 Production Risk Error
High — WAL-mode reads will fail without shm.
What this means
SQLITE_IOERR_SHMMAP (5386) is returned when SQLite cannot memory-map the WAL shared-memory file (-shm). This prevents WAL-mode readers from accessing the database.
Why it happens
- 1Insufficient virtual address space (32-bit process with large shm file).
- 2Permissions on the -shm file do not allow the current user to map it.
- 3Filesystem does not support shared memory mapping.
How to reproduce
WAL-mode database open when the -shm file cannot be memory-mapped.
# WAL databases require a -shm file; mmap failure →
# sqlite3.OperationalError: disk I/O errorFix 1
Why this works
Ensure all processes accessing the WAL database run as the same user or share group permissions.
Fix 2
Why this works
Use WAL2 or check -shm file permissions: ls -la my.db-shm
Fix 3
Why this works
Switch to rollback journal mode if shm is not available: PRAGMA journal_mode=DELETE
Sources
📚 Official docs: https://www.sqlite.org/rescode.html#ioerr_shmmap
🔧 Source ref: sqlite3.h — SQLITE_IOERR_SHMMAP = 5386
📖 Further reading: WAL shared memory
Confidence assessment
⚠️ MEDIUM confidence
Stable.
See also
📄 Reference pages