-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enqueue jobs inside a connected_to block #369
Comments
Ohhh, totally! Let me look into this one to see how to fix, I think it's something Solid Queue should handle. Thanks for the report! |
Same issue here. is there a workaround? my entire controller is in a ActiveRecord::Base.connected_to(role: :writing, shard: :queue) do
Workers::Foobar.perform_later(account_id: account_id, id: id)
end |
Same problem for me, I'm working on switching my multi-tenant app to SQLite (one database per tenant) using sharding, while keep the SolidQueue database separated. Please let me know how I could help, or if sharing more code would be helpful. I'm happy to help fix the issue as well. class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
connects_to shards: Tenant.shards.map { |shard|
[ shard, { writing: shard } ]
}.to_h
end Production config: config.active_job.queue_adapter = :solid_queue
config.solid_queue.connects_to = { database: { writing: :queue } } Tenant switching logic (simplified): module Tenant
extend self
def switch(tenant)
ActiveRecord::Base.connected_to(shard: tenant.to_sym) do
yield
end
end
# ...
end But trying to enqueue jobs gives me that error trace: Stacktrace
|
Sorry for the delay on this one, I haven't managed to look into it yet, but it's definitely on my radar. I'll try next week 🤞 |
Thanks @rosa! I just gave a tried to this patch on production, and it seems to work like a charm. # config/initializers/solid_queue_patch.rb
Rails.application.config.to_prepare do
module CurrentShardPatch
def current_shard; :queue end
end
SolidQueue::Record.send(:extend, CurrentShardPatch)
end My app is open-source, so you can give it a look if that's helpful to you.
|
Oh, awesome! I'm sure this is going to be super helpful! I'll look into all those next week, too 🙏 Thank you so much! |
Hi @rosa, just checking in to see if there have been any updates on this issue. I’m still encountering the same problem with enqueuing jobs inside a |
@hubertjakubiak so sorry for the delay! I did look into it but was immediately pulled into other directions before I could figure out anything, but this is definitely high on my list. |
Hey @hubertjakubiak, @thibaudgg, @bubiche, I'm back again with something I did find back then, and that just revisited... and it was that things work fine as long as you don't pollute I configured some sharded records as follows:
primary:
<<: *default
database: <%= database_name_from("development") %>
shard_one:
<<: *default
database: <%= database_name_from("development_shard_one") %>
migrations_paths: db/migrate_shards
shard_two:
<<: *default
database: <%= database_name_from("development_shard_two") %>
migrations_paths: db/migrate_shards
queue:
<<: *default
database: <%= database_name_from("development_queue") %>
migrations_paths: db/queue_migrate Then in the app: class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
end
class ShardedRecord < ApplicationRecord
self.abstract_class = true
connects_to shards: {
shard_one: { writing: :shard_one },
shard_two: { writing: :shard_two }
}
end
class JobResult < ApplicationRecord
end
class ShardedJobResult < ShardedRecord
end Then, the following doesn't work (this might have been a result of changes to connection pool management since the Rail guides for horizontal sharding were written): ActiveRecord::Base.connected_to(role: :writing, shard: :shard_two) do
JobResult.create!
ShardedJobResult.create!(value: "in shard two")
end
No connection pool for 'ActiveRecord::Base' found for the 'shard_two' shard. (ActiveRecord::ConnectionNotEstablished) The following works: ShardedRecord.connected_to(role: :writing, shard: :shard_two) do
JobResult.create!(value: "right place")
ShardedJobResult.create!(value: "in shard two")
end
TRANSACTION (1.5ms) BEGIN
JobResult Create (3.4ms) INSERT INTO `job_results` (`queue_name`, `status`, `value`, `created_at`, `updated_at`) VALUES (NULL, NULL, 'right place', '2024-12-05 20:41:54.697692', '2024-12-05 20:41:54.697692')
TRANSACTION (4.0ms) COMMIT
TRANSACTION (0.9ms) BEGIN
ShardedJobResult Create (2.0ms) INSERT INTO `sharded_job_results` (`value`, `created_at`, `updated_at`) VALUES ('in shard two', '2024-12-05 20:41:54.720816', '2024-12-05 20:41:54.720816')
TRANSACTION (2.1ms) COMMIT
=> #<ShardedJobResult:0x000000011fc70c98 id: 2, value: "in shard two", created_at: Thu, 05 Dec 2024 20:41:54.720816000 UTC +00:00, updated_at: Thu, 05 Dec 2024 20:41:54.720816000 UTC +00:00> And the following also works, with everything created in the corresponding DB: ShardedRecord.connected_to(role: :writing, shard: :shard_two) do
JobResult.create!(value: "right place")
ShardedJobResult.create!(value: "in shard two")
AddToBufferJob.perform_later(2)
end
TRANSACTION (1.7ms) BEGIN
JobResult Create (4.3ms) INSERT INTO `job_results` (`queue_name`, `status`, `value`, `created_at`, `updated_at`) VALUES (NULL, NULL, 'right place', '2024-12-05 20:42:53.607259', '2024-12-05 20:42:53.607259')
TRANSACTION (4.4ms) COMMIT
TRANSACTION (1.1ms) BEGIN
ShardedJobResult Create (2.3ms) INSERT INTO `sharded_job_results` (`value`, `created_at`, `updated_at`) VALUES ('in shard two', '2024-12-05 20:42:53.626346', '2024-12-05 20:42:53.626346')
TRANSACTION (2.4ms) COMMIT
TRANSACTION (0.7ms) BEGIN
SolidQueue::Job Create (2.3ms) INSERT INTO `solid_queue_jobs` (`queue_name`, `class_name`, `arguments`, `priority`, `active_job_id`, `scheduled_at`, `finished_at`, `concurrency_key`, `created_at`, `updated_at`) VALUES ('background', 'AddToBufferJob', '{\"job_class\":\"AddToBufferJob\",\"job_id\":\"3f2b5646-5905-43e0-ad97-7fab2c425494\",\"provider_job_id\":null,\"queue_name\":\"background\",\"priority\":null,\"arguments\":[2],\"executions\":0,\"exception_executions\":{},\"locale\":\"en\",\"timezone\":\"UTC\",\"enqueued_at\":\"2024-12-05T20:42:53.666927000Z\",\"scheduled_at\":\"2024-12-05T20:42:53.666125000Z\"}', 0, '3f2b5646-5905-43e0-ad97-7fab2c425494', '2024-12-05 20:42:53.666125', NULL, NULL, '2024-12-05 20:42:53.702207', '2024-12-05 20:42:53.702207')
TRANSACTION (0.6ms) SAVEPOINT active_record_1
SolidQueue::Job Load (1.7ms) SELECT `solid_queue_jobs`.* FROM `solid_queue_jobs` WHERE `solid_queue_jobs`.`id` = 3 LIMIT 1
SolidQueue::ReadyExecution Create (0.8ms) INSERT INTO `solid_queue_ready_executions` (`job_id`, `queue_name`, `priority`, `created_at`) VALUES (3, 'background', 0, '2024-12-05 20:42:53.740160')
TRANSACTION (0.5ms) RELEASE SAVEPOINT active_record_1
TRANSACTION (2.6ms) COMMIT
Enqueued AddToBufferJob (Job ID: 3f2b5646-5905-43e0-ad97-7fab2c425494) to SolidQueue(background) with arguments: 2 So, I wonder if things would work fine if you switched from using ApplicationRecord.connected_to(shard: tenant.to_sym) do
yield
end I feel I'm missing something here 😳 |
Hey @rosa, thanks for looking into this and for your detailed answer. Your suggestion to switch from It might just be a unique aspect of my environment, where I have no So far, the patch I mentioned above has been working like a charm on production. |
@thibaudgg good point! I think in that case, you could rely on ActiveRecord::Base.connected_to_many(ApplicationRecord, ActiveStorage::Record, role: :writing, shard: tenant.to_sym) do
yield
end The more I've been looking into the connection handling code, the more I think the guides are wrong/outdated and that I'm going to propose a PR to update the guides shortly. |
ActiveRecord::Base.connected_to_many(GlobalDB, role: :reading) do
ActiveRecord::Base.connected_to_many(CustomerDB, role: :writing, shard: "customer_NN") do
@app.call(env)
end
end There's a discussion about activestorage and sharded databases too: #53602 |
Ohhhh, great point @robacarp. Thanks a lot for sharing that. Going to read that carefully and the forum thread linked there. It seems this area has still some open questions 🤔 |
Hmm... wait, @robacarp, I think your example above would be expected in any case, if you have different models with different DB configurations 🤔 It could be written like: GlobalDB.connected_to(role: :reading) do
CustomerDB.connected_to(role: :writing, shard: "customerNN") do
@app.call(env)
end
end but I think this is expected and how it's supposed to work 🤔 The problem with ActiveRecord::Base.connected_to_many(StateModel, ActiveStorage::Record, shard: shard_for_subdomain, role: :writing) do
@app.call(env)
end |
@rosa We're veering off topic of solid_queue here a bit but I really appreciate you paying such close attention. My intent above was primarily to link the active storage issue because the solution here and there will probably be similar if not related. The problem we have with ActiveStorage::Record is that we want to store and attach blobs both in the shards, and in the global database -- models which "attach" and are subclasses of a Shard should use tables (and controllers!) associated with the shard, and models which are subclasses of a non-sharded abstract table should use tables connected to that named database. Nested As mentioned on that issue, there are workarounds for some of this. Notably missing is a workaround to properly use the activestorage front-end utilities. |
Ahhhh! Thanks for the extra explanation, that makes sense 🙏 No problem at all with going off-topic, this was super helpful for me as I try to figure out the best way to fix this and also the best way to add sharding support to Solid Queue itself, so yeah, super super helpful and relevant! ❤️ Thank you so much. |
Hey @rosa, thanks for pointing the I tried it out, but I’m getting an I want with something similar to: ActiveRecord::Base.connected_to_many(ApplicationRecord, ActiveStorage::Record, role: :writing, shard: tenant.to_sym) do
yield
end |
Ohh, interesting! I thought that error happened when you were trying to write concurrently, and one write needs to wait to obtain a lock, and it times out 🤔 This doesn't happen when you do ActiveRecord::Base.connected_to(role: :writing, shard: tenant.to_sym) do
...
end I'd imagine it happening in the same way 🤔 |
Yeah, I'm a bit confused about why am I getting this error as well. This is certainly happening on reading (e.g., loading a page with an attachment), not only writing. 🤔 Yes, when using simply |
Yes, it's strange! I think this should have gotten a different error, but have you tried increasing Active Record's pool size? |
@rosa yes, I did already, but sadly it doesn't resolve the issue (no change at all). Are you confident that having twice the same SQLite DB (with the |
Nope, not confident, it seems it should work just from reading the docs, but I haven't tested this with SQLite or dug into the code. I'll check it out. |
Ok, I've tested this with Active Storage in a new app and it seems to be working fine 🤔 I have two shards: development:
shard_one:
<<: *default
database: storage/development_shard_one.sqlite3
migrations_paths: db/migrate
shard_two:
<<: *default
database: storage/development_shard_two.sqlite3
migrations_paths: db/migrate class ApplicationRecord < ActiveRecord::Base
primary_abstract_class
connects_to shards: {
shard_one: { writing: :shard_one },
shard_two: { writing: :shard_two }
}
end Then, this initializer so Active Storage knows about the shards. @thibaudgg, I haven't found something like this in your app 🤔 If you're using ActiveSupport.on_load(:active_storage_record) do
connects_to shards: {
shard_one: { writing: :shard_one },
shard_two: { writing: :shard_two }
}
end Then I have just a single model: class Dog < ApplicationRecord
has_one_attached :photo
def attach_test_photo
photo.attach(io: File.open("/tmp/photo.png"), filename: "photo.png")
end
end Then the following all works as expected: >> Dog.first.attach_test_photo This uses the first shard by default. Checking the DB directly:
Then reading from each shard: >> ActiveRecord::Base.connected_to_many(ApplicationRecord, ActiveStorage::Record, role: :writing, shard: :shard_two) do
ActiveStorage::Blob.count
end
ActiveStorage::Blob Count (2.8ms) SELECT COUNT(*) FROM "active_storage_blobs" /*application='PhantomDbSqliteRepro'*/
=> 0
>> ActiveRecord::Base.connected_to_many(ApplicationRecord, ActiveStorage::Record, role: :writing, shard: :shard_one) do
ActiveStorage::Blob.count
end
ActiveStorage::Blob Count (0.1ms) SELECT COUNT(*) FROM "active_storage_blobs" /*application='PhantomDbSqliteRepro'*/
=> 1 So it seems this works as expected 🤔 Not sure if you can see anything fundamentally different from your app here (besides |
@rosa thanks again taking the time and your detailed answer.
Yes, I have set a similar initializer in my local branch to test Reading with Giving your code example, you should be able to reproduce it with something like that: ActiveRecord::Base.connected_to_many(ApplicationRecord, ActiveStorage::Record, role: :writing, shard: :shard_two) do
# Should work fine
Dog.count
ActiveStorage::Blob.count
# Should raise an error
Dog.create!
Dog.first.attach_test_photo
end Is this snippet failing for you too? PS: As you are most likely well aware 😅, running this from the Rails console in the development environment makes use of the |
Ah! I tried reading as you said you were getting the error on reading too, but testing writing, this works fine 😕 >> ActiveRecord::Base.connected_to_many(ApplicationRecord, ActiveStorage::Record, role: :writing, shard: :shard_two) do
# Should work fine
Dog.count
ActiveStorage::Blob.count
# Should raise an error
Dog.create!
Dog.first.attach_test_photo
end
Dog Count (3.3ms) SELECT COUNT(*) FROM "dogs" /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Blob Count (0.6ms) SELECT COUNT(*) FROM "active_storage_blobs" /*application='PhantomDbSqliteRepro'*/
TRANSACTION (0.0ms) BEGIN immediate TRANSACTION /*application='PhantomDbSqliteRepro'*/
Dog Create (0.4ms) INSERT INTO "dogs" ("name", "features", "nickname", "created_at", "updated_at") VALUES (NULL, NULL, NULL, '2024-12-10 15:53:00.722864', '2024-12-10 15:53:00.722864') RETURNING "id" /*application='PhantomDbSqliteRepro'*/
TRANSACTION (0.7ms) COMMIT TRANSACTION /*application='PhantomDbSqliteRepro'*/
Dog Load (0.1ms) SELECT "dogs".* FROM "dogs" ORDER BY "dogs"."id" ASC LIMIT 1 /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Blob Load (0.1ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" INNER JOIN "active_storage_attachments" ON "active_storage_blobs"."id" = "active_storage_attachments"."blob_id" WHERE "active_storage_attachments"."record_id" = 1 AND "active_storage_attachments"."record_type" = 'Dog' AND "active_storage_attachments"."name" = 'photo' LIMIT 1 /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Attachment Load (0.0ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = 1 AND "active_storage_attachments"."record_type" = 'Dog' AND "active_storage_attachments"."name" = 'photo' LIMIT 1 /*application='PhantomDbSqliteRepro'*/
TRANSACTION (0.0ms) BEGIN immediate TRANSACTION /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Blob Create (0.2ms) INSERT INTO "active_storage_blobs" ("key", "filename", "content_type", "metadata", "service_name", "byte_size", "checksum", "created_at") VALUES ('0rawu5e1vvs4dquf80be7ub0ekaj', 'photo.png', 'image/png', '{"identified":true}', 'local', 1620147, 'GiSsNzp7B+EFOaS+vBTojg==', '2024-12-10 15:53:00.755736') RETURNING "id" /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Attachment Create (0.0ms) INSERT INTO "active_storage_attachments" ("name", "record_type", "record_id", "blob_id", "created_at") VALUES ('photo', 'Dog', 1, 1, '2024-12-10 15:53:00.758157') RETURNING "id" /*application='PhantomDbSqliteRepro'*/
TRANSACTION (0.1ms) COMMIT TRANSACTION /*application='PhantomDbSqliteRepro'*/
Enqueued ActiveStorage::AnalyzeJob (Job ID: 9a249c26-59a5-4e6a-91f0-058f84ba8324) to Async(default) with arguments: #<GlobalID:0x000000014b8f4cc8 @uri=#<URI::GID gid://phantom-db-sqlite-repro/ActiveStorage::Blob/1>>
↳ app/models/dog.rb:5:in `attach_test_photo'
TRANSACTION (0.0ms) BEGIN immediate TRANSACTION /*application='PhantomDbSqliteRepro'*/
Dog Update (0.2ms) UPDATE "dogs" SET "updated_at" = '2024-12-10 15:53:00.761401' WHERE "dogs"."id" = 1 /*application='PhantomDbSqliteRepro'*/
TRANSACTION (0.0ms) COMMIT TRANSACTION /*application='PhantomDbSqliteRepro'*/
Disk Storage (4.6ms) Uploaded file to key: 0rawu5e1vvs4dquf80be7ub0ekaj (checksum: GiSsNzp7B+EFOaS+vBTojg==) And these are visible in the sqlite> select count(*) from active_storage_blobs ;
1
sqlite> select count(*) from active_storage_attachments;
1 How strange! And yes, this is using the
|
How strange indeed! The only change I was able to think of is that in my case, I attach a PDF file and not a PNG. I tried with a PNG, and it works fine for me too! 🤯 For science, could you give a try to a PDF file? I can also try to reproduce on a fresh new Rails app, some custom logic might be in cause here, but so fare I haven't been able to put my finger in. I wonder if some
|
Oh wow! Great catch! 🔍 💯 Going to check with a PDF file as well! |
Aha! I can indeed reproduce with a PDF file: class Dog < ApplicationRecord
has_one_attached :photo
def attach_test_photo
photo.attach(io: File.open("/tmp/sample.pdf"), filename: "sample.pdf")
end
end And then: >> ActiveRecord::Base.connected_to_many(ApplicationRecord, ActiveStorage::Record, role: :writing, shard: :shard_two) do
# Should work fine
Dog.count
ActiveStorage::Blob.count
# Should raise an error
Dog.create!
Dog.first.attach_test_photo
end
Dog Count (1.7ms) SELECT COUNT(*) FROM "dogs" /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Blob Count (2.2ms) SELECT COUNT(*) FROM "active_storage_blobs" /*application='PhantomDbSqliteRepro'*/
TRANSACTION (0.0ms) BEGIN immediate TRANSACTION /*application='PhantomDbSqliteRepro'*/
Dog Create (0.4ms) INSERT INTO "dogs" ("name", "features", "nickname", "created_at", "updated_at") VALUES (NULL, NULL, NULL, '2024-12-10 17:58:52.790575', '2024-12-10 17:58:52.790575') RETURNING "id" /*application='PhantomDbSqliteRepro'*/
TRANSACTION (0.0ms) COMMIT TRANSACTION /*application='PhantomDbSqliteRepro'*/
Dog Load (1.7ms) SELECT "dogs".* FROM "dogs" ORDER BY "dogs"."id" ASC LIMIT 1 /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Blob Load (0.0ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" INNER JOIN "active_storage_attachments" ON "active_storage_blobs"."id" = "active_storage_attachments"."blob_id" WHERE "active_storage_attachments"."record_id" = 1 AND "active_storage_attachments"."record_type" = 'Dog' AND "active_storage_attachments"."name" = 'photo' LIMIT 1 /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Attachment Load (0.0ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."record_id" = 1 AND "active_storage_attachments"."record_type" = 'Dog' AND "active_storage_attachments"."name" = 'photo' LIMIT 1 /*application='PhantomDbSqliteRepro'*/
TRANSACTION (0.1ms) BEGIN immediate TRANSACTION /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Attachment Destroy (0.5ms) DELETE FROM "active_storage_attachments" WHERE "active_storage_attachments"."id" = 1 /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Blob Create (0.1ms) INSERT INTO "active_storage_blobs" ("key", "filename", "content_type", "metadata", "service_name", "byte_size", "checksum", "created_at") VALUES ('snj1kva4hbk4dcdft8ei550ph0o5', 'sample.pdf', 'application/pdf', '{"identified":true}', 'local', 84574, '0zqKIzSeM5UfB0flo3IyGw==', '2024-12-10 17:58:52.851668') RETURNING "id" /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Attachment Create (0.0ms) INSERT INTO "active_storage_attachments" ("name", "record_type", "record_id", "blob_id", "created_at") VALUES ('photo', 'Dog', 1, 2, '2024-12-10 17:58:52.853486') RETURNING "id" /*application='PhantomDbSqliteRepro'*/
TRANSACTION (0.2ms) COMMIT TRANSACTION /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Blob Load (0.7ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = 1 LIMIT 1 /*application='PhantomDbSqliteRepro'*/
Enqueued ActiveStorage::PurgeJob (Job ID: 7092254f-4ee4-49db-aca7-8ccd7837a59a) to Async(default) with arguments: #<GlobalID:0x0000000128e36150 @uri=#<URI::GID gid://phantom-db-sqlite-repro/ActiveStorage::Blob/1>>
↳ app/models/dog.rb:5:in `attach_test_photo'
TRANSACTION (0.0ms) BEGIN immediate TRANSACTION /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Blob Update (0.9ms) UPDATE "active_storage_blobs" SET "metadata" = '{"identified":true,"analyzed":true}' WHERE "active_storage_blobs"."id" = 2 /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Attachment Load (0.1ms) SELECT "active_storage_attachments".* FROM "active_storage_attachments" WHERE "active_storage_attachments"."blob_id" = 2 /*application='PhantomDbSqliteRepro'*/
ActiveStorage::Blob Load (1.8ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = 1 LIMIT 1 /*application='PhantomDbSqliteRepro'*/
Discarded ActiveStorage::PurgeJob (Job ID: 7092254f-4ee4-49db-aca7-8ccd7837a59a) due to a ActiveRecord::RecordNotFound (Couldn't find ActiveStorage::Blob with 'id'=1).
Performed ActiveStorage::PurgeJob (Job ID: 7092254f-4ee4-49db-aca7-8ccd7837a59a) from Async(default) in 6.1ms
TRANSACTION (5025.9ms) BEGIN immediate TRANSACTION /*application='PhantomDbSqliteRepro'*/
Dog Load (5026.2ms) SELECT "dogs".* FROM "dogs" WHERE "dogs"."id" = 1 /*application='PhantomDbSqliteRepro'*/
TRANSACTION (0.1ms) ROLLBACK TRANSACTION /*application='PhantomDbSqliteRepro'*/
app/models/dog.rb:5:in `attach_test_photo': SQLite3::BusyException: database is locked (ActiveRecord::StatementTimeout)
from (phantom-db-sqlite-repro):7:in `block in <main>'
from (phantom-db-sqlite-repro):1:in `<main>'
/Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/sqlite3/database_statements.rb:100:in `step': database is locked (SQLite3::BusyException)
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/sqlite3/database_statements.rb:100:in `perform_query'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:556:in `block (2 levels) in raw_execute'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:1011:in `block in with_raw_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:983:in `with_raw_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:1129:in `log'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/sqlite3/database_statements.rb:71:in `internal_begin_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/sqlite3/database_statements.rb:33:in `begin_db_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:455:in `materialize!'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:584:in `block (2 levels) in materialize_transactions'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:584:in `each'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:584:in `block in materialize_transactions'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:581:in `materialize_transactions'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `materialize_transactions'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:986:in `block in with_raw_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:983:in `with_raw_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:555:in `block in raw_execute'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:1129:in `log'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:554:in `raw_execute'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:591:in `internal_execute'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:547:in `internal_exec_query'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:693:in `select'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:73:in `select_all'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/query_cache.rb:251:in `select_all'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/querying.rb:68:in `_query_by_sql'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1449:in `block (2 levels) in exec_main_query'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_handling.rb:310:in `with_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1448:in `block in exec_main_query'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1470:in `skip_query_cache_if_necessary'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1432:in `exec_main_query'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1410:in `block in exec_queries'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1470:in `skip_query_cache_if_necessary'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1404:in `exec_queries'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1181:in `load'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/preloader/association.rb:56:in `load_records_for_keys'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/preloader/association.rb:92:in `load_records'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/preloader/association.rb:71:in `records'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/preloader/association.rb:29:in `records_for'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/preloader/association.rb:33:in `load_records_in_batch'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/preloader/batch.rb:42:in `block in group_and_load_similar'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/preloader/batch.rb:41:in `each_pair'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/preloader/batch.rb:41:in `group_and_load_similar'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/preloader/batch.rb:27:in `call'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/preloader.rb:121:in `call'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1326:in `block in preload_associations'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1325:in `each'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1325:in `preload_associations'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1414:in `block in exec_queries'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1470:in `skip_query_cache_if_necessary'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1404:in `exec_queries'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/association_relation.rb:44:in `exec_queries'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:1181:in `load'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation.rb:343:in `records'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/relation/delegation.rb:101:in `each'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activestorage-8.0.0/app/models/active_storage/blob.rb:386:in `touch_attachments'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:361:in `block in make_lambda'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:207:in `call'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:562:in `block in invoke_after'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:562:in `each'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:562:in `invoke_after'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:110:in `run_callbacks'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:912:in `_run_update_callbacks'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/callbacks.rb:449:in `_update_record'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/timestamp.rb:122:in `_update_record'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/persistence.rb:894:in `create_or_update'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/callbacks.rb:441:in `block in create_or_update'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:120:in `block in run_callbacks'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/autosave_association.rb:396:in `around_save_collection_association'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:129:in `block in run_callbacks'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:140:in `run_callbacks'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:912:in `_run_save_callbacks'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/callbacks.rb:441:in `create_or_update'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/timestamp.rb:127:in `create_or_update'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/persistence.rb:424:in `save!'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/validations.rb:54:in `save!'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:366:in `block in save!'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:418:in `block (2 levels) in with_transaction_returning_status'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:357:in `transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:414:in `block in with_transaction_returning_status'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_handling.rb:310:in `with_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:410:in `with_transaction_returning_status'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:366:in `save!'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/suppressor.rb:56:in `save!'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/persistence.rb:579:in `block in update!'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:418:in `block (2 levels) in with_transaction_returning_status'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:414:in `block in with_transaction_returning_status'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:406:in `with_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_handling.rb:310:in `with_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:410:in `with_transaction_returning_status'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/persistence.rb:577:in `update!'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activestorage-8.0.0/app/models/active_storage/blob/analyzable.rb:30:in `analyze'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activestorage-8.0.0/app/models/active_storage/blob/analyzable.rb:41:in `analyze_later'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activestorage-8.0.0/app/models/active_storage/attachment.rb:127:in `analyze_blob_later'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:361:in `block in make_lambda'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:207:in `call'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:562:in `block in invoke_after'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:562:in `each'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:562:in `invoke_after'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:110:in `run_callbacks'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:912:in `_run_commit_callbacks'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:385:in `committed!'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:307:in `block in commit_records'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:344:in `run_action_on_records'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:306:in `commit_records'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:606:in `block in commit_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:594:in `commit_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:638:in `block in within_new_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:234:in `block in transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:412:in `with_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_handling.rb:310:in `with_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:233:in `transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/has_one_association.rb:127:in `transaction_if'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/has_one_association.rb:68:in `replace'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/singular_association.rb:26:in `writer'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/associations/builder/association.rb:113:in `photo_attachment='
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activestorage-8.0.0/lib/active_storage/attached/changes/create_one.rb:49:in `public_send'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activestorage-8.0.0/lib/active_storage/attached/changes/create_one.rb:49:in `save'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activestorage-8.0.0/lib/active_storage/attached/model.rb:142:in `block in has_one_attached'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:406:in `instance_exec'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:406:in `block in make_lambda'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:207:in `call'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:562:in `block in invoke_after'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:562:in `each'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:562:in `invoke_after'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:110:in `run_callbacks'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/callbacks.rb:912:in `_run_save_callbacks'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/callbacks.rb:441:in `create_or_update'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/timestamp.rb:127:in `create_or_update'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/persistence.rb:391:in `save'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/validations.rb:48:in `save'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:362:in `block in save'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:418:in `block (2 levels) in with_transaction_returning_status'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:626:in `block in within_new_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:623:in `within_new_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:367:in `within_new_transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:359:in `transaction'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:414:in `block in with_transaction_returning_status'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:412:in `with_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_handling.rb:310:in `with_connection'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:410:in `with_transaction_returning_status'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/transactions.rb:362:in `save'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/suppressor.rb:52:in `save'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activestorage-8.0.0/lib/active_storage/attached/one.rb:61:in `attach'
from /Users/rosa/Work/rosa/phantom-db-sqlite-repro/app/models/dog.rb:5:in `attach_test_photo'
from (phantom-db-sqlite-repro):7:in `block in <main>'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0/lib/active_record/connection_handling.rb:175:in `connected_to_many'
from (phantom-db-sqlite-repro):1:in `<main>'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/workspace.rb:121:in `eval'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/workspace.rb:121:in `evaluate'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/context.rb:622:in `evaluate_expression'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb/context.rb:590:in `evaluate'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1051:in `block (2 levels) in eval_input'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1363:in `signal_status'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1043:in `block in eval_input'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1122:in `block in each_top_level_statement'
from <internal:kernel>:187:in `loop'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1119:in `each_top_level_statement'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1042:in `eval_input'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1023:in `block in run'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1022:in `catch'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/irb-1.14.1/lib/irb.rb:1022:in `run'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/commands/console/irb_console.rb:122:in `start'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/commands/console/console_command.rb:59:in `start'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/commands/console/console_command.rb:8:in `start'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/commands/console/console_command.rb:87:in `perform'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/command/base.rb:178:in `invoke_command'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/command/base.rb:73:in `perform'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/command.rb:65:in `block in invoke'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/command.rb:143:in `with_argv'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/command.rb:63:in `invoke'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/railties-8.0.0/lib/rails/commands.rb:18:in `<main>'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/3.3.0/bundled_gems.rb:69:in `require'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/3.3.0/bundled_gems.rb:69:in `block (2 levels) in replace_require'
from /Users/rosa/.local/share/mise/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
from bin/rails:4:in `<main>'
>> But in this case, looks like the purge job ran fine, though it couldn't find a blob with
The |
Ok, I found the reason why this happens with a PDF and not with a PNG. The reason is that, when attaching the blob, this method gets called. The I don't know yet why the callback works just fine when using |
Aha! I think I found the reason why this doesn't happen when using config.active_storage.touch_attachment_records = false makes the problem disappear. |
@rosa so happy you were able to reproduce the error 🙌🏻 I can confirm that setting That said, running my specs still raise My test config is: # config/environments/test.rb
config.active_storage.service = :test
config.active_storage.touch_attachment_records = false Please let me know if I can help debugging it further. |
My rails application connects to multiple databases with the configs below:
database.yml
config/initializers/database.rb
SolidQueue
has been working well, the only time where we cannot enqueue is if we have a block of code like below:I think it is because
SolidQueue
is trying to insert the job intosecondary_shard
instead of thequeue
database. Is there any way to circumvent this besides rewriting the code to callperform_later
outside of theconnected_to
block?SomeJob.perform_later
might be called inside a function with theconnected_to
block so it's quite a big refactor for us.The text was updated successfully, but these errors were encountered: