Supress sqlite fork warnings for rails 7.1 & 7.2 by p-schlickmann · Pull Request #611 · rails/solid_queue
When sqlite3 > 2.1.0 and rails < 8.0.0 we have the following warning when using Solid Queue:
.rbenv/versions/3.3.6/lib/ruby/gems/3.3.0/gems/sqlite3-2.5.0-x86_64-linux-gnu/lib/sqlite3/fork_safety.rb:43: warning: Writable sqlite database connection(s) were inherited from a forked process. This is unsafe and the connectio
ns are being closed to prevent possible data corruption. Please close writable sqlite database connections before forking.
This is polluting our CI logs and triggering warnings for people using Solid Queue with Rails 7.1 and 7.2 - although the behaviour is safe: #324 (comment)
Also mentioned in: #506
Hey @p-schlickmann, thanks a lot for this! I think I'd keep only the call for tests only, in test/test_helpers/processes_test_helper.rb, but not the one in the supervisor code. I'd leave that to Solid Queue users on Rails < 8 to decide whether they want to call that or not (and maybe they can do it in the on_start hook, because I think the warnings happen on fork, and on_start runs before forking in the Supervisor 🤔 ).
Yes, @rosa, that approach should work!
But in addition to cleaning up the CI logs, the goal of this PR is to reassure Solid Queue users on Rails 7.1 and 7.2 that the forking warning is harmless and can be safely ignored.
Maybe it makes sense to open a PR against the Rails repo to suppress this warning upstream in Rails 7 itself? Like they did for Rails 8?
@rosa, unfortunately we can’t apply the same fix in Rails 7 because SQLite3::ForkSafety.suppress_warnings! was included in sqlite3 >= 2.1, while Rails 7 minimum supported version is 1.4.
I don't think a warning is gonna make the rails team bump such a major version like that.
In any case, I’ve pushed a commit to suppress those warnings in our CI, so our test output is now completely clean 🎉
rosa approved these changes Jul 28, 2025
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thank you!
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