Bump sqlite-database-integration to v3.0.0-rc.6 for the SET write-lock fix#4033
Conversation
wojtekn
left a comment
There was a problem hiding this comment.
I tested basic flows like export, creating new site, and checked my existing site and everything works fine.
katinthehatsite
left a comment
There was a problem hiding this comment.
The changes look good to me and all the checks are passing 👍
One bit of feedback that I have is regarding the proposed changes section: it can definitelly be shorter as I am not sure all of that is needed to understand the change.
Thanks, I'll keep that in mind. For this PR, I wanted to add the problem's context to this repo too, because the fix itself lives in the WordPress/sqlite-database-integration repo. |
Related issues
How AI was used in this PR
Used Claude to create the PR.
Proposed Changes
On busy sites, WordPress requests can fail with
database is locked(SQLITE_BUSY) at connect time, and not only writes, but on ordinary page loads too.This is beacuse every WordPress request runs
SET SESSION sql_mode = …at bootstrap. The bundledsqlite-database-integrationdriver acquires an SQLite write lock for that statement, even thoughSETwrites nothing. SQLite allows only one writer at a time per database file, so whenever any other connection is holding the write lock, eg. a slow WooCommerce/Jetpack/import write transaction on a heavy site, every concurrent request is blocked at connect and, after the 10-second busy timeout, crashes. This surfaces only when requests run in parallel.This PR bumps the bundled plugin from
v3.0.0-rc.4tov3.0.0-rc.6, which resolves this issue upstream:SETis now treated as read-only and opens a deferred transaction instead ofBEGIN IMMEDIATE, and empty result sets are built without taking a write lock (Don't take a write lock for SET statements (fixes "database is locked" on connect) WordPress/sqlite-database-integration#443 — the direct fix for the reported error).synchronous = NORMAL, carried over from rc.5, reducing reader <-> writer contention and improving throughput.The user impact is that heavy sites no longer crash with
database is lockedunder concurrent load, and general database throughput improves.Note for reviewers: rc.6 also includes an upstream parser change, so this bump pulls in more than the targeted fix. Broad site testing is worthwhile.
Testing Instructions
npm install(this downloads rc.6). Confirmapps/studio/src/constants.tspinsv3.0.0-rc.6.PRAGMA journal_modereportswal.Optional: reproduce the original bug to see the fix
/wp-content/mu-plugins/lock-repro.php:PORTin the snippet below then make request A:Request A holds the write lock for 15s. Request B is an ordinary page load whose
SET SESSION sql_modeconnect-time operation needs the write lock as well. A quick sanity check: running request B without a holder, so skipping request A, itshould always be an instant HTTP 200. The bug only appears while the lock is held.
Expected results:
trunk)database is lockedfatal after ~10sPre-merge Checklist