fix(ios): configure SQLite thread safety - #325
Merged
Merged
Conversation
chrispader
added this pull request to stack #327
September 10, 2026 13:41
chrispader
force-pushed
the
codex/configurable-sqlite-threading
branch
from
September 10, 2026 14:01
9f6cbcf to
796eff4
Compare
chrispader
removed this pull request from stack #327
September 10, 2026 14:09
chrispader
added this pull request to stack #329
September 10, 2026 14:10
Default bundled SQLite builds to serialized mode while allowing explicit 0 or 1 selection through NITRO_SQLITE_THREADSAFE. Preserve the existing performance flags and document the system SQLite exception. Co-authored-by: samuelscheit <github@samuelscheit.com>
chrispader
force-pushed
the
codex/configurable-sqlite-threading
branch
from
September 10, 2026 16:04
796eff4 to
6a75512
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
iOS builds currently compile bundled SQLite with
SQLITE_THREADSAFE=0, which removes its mutex code even though Nitro runs asynchronous operations on multiple native threads. This makes concurrent SQLite access unsafe, as reported in #312. This PR restores serialized mode by default and lets applications configure it in theirpackage.json.The
nitroSQLite.threadSafesetting acceptstrueorfalseand defaults totrue.NITRO_SQLITE_THREADSAFEcan override it for a Pod installation usingtrue,false,1, or0, which is useful in CI. The podspec retains the existing SQLite performance flags, while the documentation explains that this setting has no compile-time effect whenNITRO_SQLITE_USE_PHONE_VERSION=1selects Apple's system SQLite library.Samuel Scheit introduced the configurable pod setting in PR #298. This PR extracts that work, defaults to
1, and credits him as co-author. It does not include the macOS or CI-platform changes from that PR.The podspec regression evaluates the package setting, environment override, defaults, invalid values, and system-library configuration. It also compiles bundled SQLite in both supported modes and checks
sqlite3_threadsafe().This fixes the compile-time default. Native connection lifetime and transaction scheduling need separate fixes; SQLite's mutexes do not provide those guarantees.