The reporter's snap, upgraded from 6.09 to 10.44, was in a systemd restart loop
at restart 72, with 8 CPUs at load 7 and SQLITE_BUSY everywhere:
error on boot.js Error [ValidationError]: Failed validation
[msg_update.go:133 ...] [collection.go:191 sqlite.(*collection).UpdateAll]
database is locked (5) (SQLITE_BUSY)
Two things here, each of which made the other worse. (The third, in the FerretDB
fork, is the `_txlock=immediate` default that lets the busy handler cover a
contended write at all.)
1. A TRANSIENT DATABASE ERROR ENDED THE BOOT. Meteor's boot.js exits the process
when a startup callback rejects, systemd restarts it, and the restart re-runs
the same startup work against a database that is busy because the previous
boot was doing it. SQLITE_BUSY means another writer had the lock - nothing is
wrong with the data - so server/00startupResilience.js wraps every startup
callback: a transient database error (the shared classifier's deadlock /
too-many-connections / connection-lost / timeout) is logged, recorded for
Admin Panel / Problems, and swallowed, and the step runs again next start.
Anything else - a full disk, a refused login, a syntax error - is rethrown, so
a real fault still stops WeKan.
2. THE BOARD-ID BACKFILL SCANNED EVERY CARD ON EVERY BOOT. It streamed the whole
Cards collection and issued one multi-update per card - 130,947 of them here,
for each of two collections - and its "anything left to do?" guard could never
go quiet, because a checklist whose card was deleted has no board id to copy
and stays missing one forever. It is driven by the rows that are MISSING the
board id now (normally none), collects their distinct card ids in bounded
chunks, and asks Cards only for those. What cannot be filled from a card is
counted and reported once. The pass is version-gated like the schema upgrade
beside it, so an unchanged version costs one findOne.
tests/sqliteBusyResilience.test.cjs pins both, including that SQLITE_BUSY
classifies as retryable contention while a full disk does not.
Thanks to Nissulya and xet7 !
Fixes#6533,