feat(store): expose mmap_size via CBM_SQLITE_MMAP_SIZE env
Hard-coded `PRAGMA mmap_size = 67108864` in configure_pragmas() left no path for users running multiple cbm-mcp instances against the same cache to opt out of memory-mapped I/O. On macOS, when one instance's checkpoint or reindex truncates the DB file under another instance's live mmap, accessing the now-missing pages raises SIGBUS, taking the process down. Setting CBM_SQLITE_MMAP_SIZE=0 reverts to read()/pread() I/O, which returns recoverable SQLITE_IOERR instead of crashing the process. - Default unchanged (67108864 / 64 MB). No behavior change for single-instance users. - Malformed values (non-numeric, partial-numeric) fall back to the default rather than failing the store open. - Negative values clamp to 0. - New tests: tests/test_store_pragmas.c covers all five resolver paths plus an integration smoke that opens a file-backed store with mmap disabled. Empirical evidence: 9 SIGBUS crash reports collected on macOS arm64 v0.6.0 in a 14-hour window, all signature 'cluster_pagein past EOF' with stacks bottoming in SQLite btree code under the watcher thread's incremental-index pipeline.
E
edwardmhughes committed
093707cda2c4e04968b5e5859f60aa770ff6ffb6
Parent: a338ff3
Committed by DeusData <martin.vogel.tech@gmail.com>
on 5/10/2026, 7:03:42 PM