What's new
If you've been losing the web UI after dropping multiple books into /cwa-book-ingest at once, this release is the fix.
docker pull ghcr.io/new-usemame/calibre-web-nextgen:v4.0.62
(or :latest)
Concurrent ingest no longer crashes the web service (#192)
The reporter on issue #192 (@magdalar) was dropping 5 large epubs into the ingest folder at once on a NAS-style setup (NETWORK_SHARE_MODE=true, local mergerfs library). The first import would succeed; the rest failed with database is locked and the web service stopped serving pages until a full container restart. Same symptom family as the open CWA upstream issue #1082.
Four interacting causes, all addressed:
- The post-ingest database-refresh path used to dispose the SQLAlchemy engine on a background worker — that raced with live requests under sustained ingest. It's now a synchronous, lightweight session refresh that doesn't touch the engine.
- The Flask app and the ingest subprocess didn't coordinate writes to
metadata.db. They now share a file lock at/config/.cwa-metadata-write.lock(always on a local Docker volume, never on the network share). That sidesteps the unreliable POSIX-lock behavior of mergerfs / SMB / NFS / Docker Desktop's virtiofs. PRAGMA busy_timeout=60000is now set on every SQLite connection, so a contended write waits up to 60s instead of failing immediately.- A transient
database is lockedfromcalibredb addis now retried with exponential backoff (2s → 4s → 8s) before giving up. Non-lock errors still surface immediately.
13 regression tests pin each contributor. Live verification on the dev container: 13 large epubs across 4 concurrent ingest waves plus a metadata edit during a wave plus 24 parallel HTTP requests during another wave — every ingest succeeded, the web service stayed responsive throughout, no books in /failed.
Credits
Thanks @magdalar for the detailed report including logs and reproduction steps.