Sqlite itself is not fork-safe. Specifically, writing in a child process to a database connection that was created in the parent process may corrupt the database file. To mitigate this risk, sqlite3-ruby has implemented the following changes:
All open writable database connections carried across a fork() will immediately be closed in the child process to mitigate the risk of corrupting the database file.
These connections will be incompletely closed ("discarded") which will result in a one-time memory leak in the child process.
If it's at all possible, we strongly recommend that you close writable database connections in the parent before forking. If absolutely necessary (and you know what you're doing), you may suppress the fork safety warnings by calling SQLite3::ForkSafety.suppress_warnings!.
See the README's "Fork Safety" section and adr/2024-09-fork-safety.md for more information. [#558, #565, #566] @flavorjones
Improved
Use sqlite3_close_v2 to close databases in a deferred manner if there are unclosed prepared statements. Previously closing a database while statements were open resulted in a BusyException. See https://www.sqlite.org/c3ref/close.html for more context. #557@flavorjones
When setting a Database busy_handler, fire the write barrier to prevent potential crashes during the GC mark phase. #556@jhawthorn
Documentation
The FAQ.md has been updated to fix some inaccuracies. #562@rickhull
Sqlite itself is not fork-safe. Specifically, writing in a child process to a database connection that was created in the parent process may corrupt the database file. To mitigate this risk, sqlite3-ruby has implemented the following changes:
All open writable database connections carried across a fork() will immediately be closed in the child process to mitigate the risk of corrupting the database file.
These connections will be incompletely closed ("discarded") which will result in a one-time memory leak in the child process.
If it's at all possible, we strongly recommend that you close writable database connections in the parent before forking. If absolutely necessary (and you know what you're doing), you may suppress the fork safety warnings by calling SQLite3::ForkSafety.suppress_warnings!.
See the README's "Fork Safety" section and adr/2024-09-fork-safety.md for more information. [#558, #565, #566] @flavorjones
Improved
Use sqlite3_close_v2 to close databases in a deferred manner if there are unclosed prepared statements. Previously closing a database while statements were open resulted in a BusyException. See https://www.sqlite.org/c3ref/close.html for more context. #557@flavorjones
When setting a Database busy_handler, fire the write barrier to prevent potential crashes during the GC mark phase. #556@jhawthorn
Documentation
The FAQ.md has been updated to fix some inaccuracies. #562@rickhull
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Bumps sqlite3 from 1.7.3 to 2.1.0.
Release notes
Sourced from sqlite3's releases.
... (truncated)
Changelog
Sourced from sqlite3's changelog.
... (truncated)
Commits
9a18cb9
version bump to v2.1.004d111c
version bump to v2.1.0.rc381fb037
Merge pull request #566 from sparklemotion/flavorjones-suppress-fork-warningsc90b177
feat: SQLite3::ForkSafety.suppress_warnings!4b6d614
version bump to v2.1.0.rc298d24ce
Merge pull request #565 from sparklemotion/flavorjones-optimize-discarded-db-...af548cf
Optimize the statement check for a non-discarded databasee621d88
doc: update garbage collection description81ea485
version bump to v2.1.0.rc15f4b0aa
doc: add a note to CONTRIBUTING.md about the /adr dirDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show