SQLite Forum

Possible regression for read-only databases in 3.46.1 (WASM)
Login

Possible regression for read-only databases in 3.46.1 (WASM)

(1) By DallasHoff on 2024-10-17 03:58:54 [source]

In the WebAssembly build of SQLite, there has been a behavior change in version 3.46.1 when interacting with a database over a connection set up with the read-only flag. Prior to 3.46.1, attempting to perform a mutating action (e.g. an INSERT) would error, but subsequent reads on the connection would still work. Since 3.46.1, trying to perform a mutation causes all subsequent queries on that connection to fail with the error SQLITE_IOERR_WRITE: sqlite3 result code 778: disk I/O error, so you have no choice but to make a new connection. Was this change in behavior intentional?

(2.1) By Stephan Beal (stephan) on 2024-10-17 11:45:01 edited from 2.0 in reply to 1 [link] [source]

Was this change in behavior intentional?

Definitely not. Which VFS are you experiencing this with?

Edit: i can now reproduce this with one out of three tested VFSes, so will assume you're using that one. The root of the problem is not immediately obvious but is under investigation.

(3) By Stephan Beal (stephan) on 2024-10-17 12:35:57 in reply to 1 [link] [source]

Since 3.46.1, trying to perform a mutation causes all subsequent queries on that connection to fail with the error SQLITE_IOERR_WRITE: sqlite3 result code 778: disk I/O error, so you have no choice but to make a new connection.

That's now fixed in the trunk and the 3.46 branch, so will be part of 3.47 and any hypothetical future 3.46 releases. Thank you very much for the report!

This problem actually dates back to the initial release of this VFS. It's possible (i've not confirmed) that it misbehaved differently in versions before 3.46 (perhaps even by hiding that misbehavior), but it was definitely not properly honoring the mode=ro flag. Tests have been added to ensure that mode=ro is honored and that the VFS behaves properly on following read-only operations after a failed-due-to-read-only error.

(4) By DallasHoff on 2024-10-18 03:33:50 in reply to 3 [link] [source]

Awesome! Thanks for looking into this.