fractaledmind / activerecord-enhancedsqlite3-adapter

ActiveRecord adapter for SQLite that enhances the default. Back-ports generated column support, deferred foreign key support, custom foreign key support, improved default configuration, and adds support for pragma tuning and extension loading
MIT License
118 stars 4 forks source link

Safety level may not be changed inside a transaction #21

Open ghaydarov opened 1 week ago

ghaydarov commented 1 week ago

After I installed this gem, I started getting this error below when uploading certain images.

ActiveRecord::StatementInvalid (SQLite3::SQLException: Safety level may not be changed inside a transaction

My Rails version is 7.2.0.beta2.

I am using litestack and separate dbs for primary and jobs etc.

I was wondering if it could be an issue with the beta version of rails.

I am using 0.8.0 version of this gem.

Any ideas? Thanks!

fractaledmind commented 1 week ago

I need a stack trace for this error to maybe get a sense of where in the stack the safety level is attempted to being changed

ghaydarov commented 1 week ago

Here is the gist of the trace:

https://gist.github.com/ghaydarov/33dc77106cd250325a5ceb7ee7d7e0fa

Thank you

ghaydarov commented 1 week ago

Btw, I am experiencing this in rails 7.1 as well. I thought this was an issue with 7.2 only.

fractaledmind commented 1 week ago

I see you are also using Litestack and Litedb. You probably don't need this gem if you are using Litestack and Litedb. Was there a particular feature you were reaching for in this gem that Litestack/Litedb doesn't provide?

ghaydarov commented 1 week ago

I ran into busy timeout issue, and found your post on it, and added your gem. https://fractaledmind.github.io/2023/12/11/sqlite-on-rails-improving-concurrency/

I don;t get that issue anymore, but not sure yet if it was due to your gem.