solid_queue: SQLite queue database corruption

I’m seeing a strange error. I dropped @fractaledmind a note and he suggested I post here.

W, [2024-09-05T18:49:32.074281 #809854]  WARN -- : SolidQueue-0.3.4 Error deregistering Supervisor (1.1ms)  process_id: 68, pid: 564289, hostname: "HOST", last_heartbeat_at: Sat, 31 Aug 2024 15:16:55.474066000 UTC +00:00, claimed_size: 0, pruned: {:process=>#<SolidQueue::Process id: 68>, :pruned=>true, :claimed_size=>0, :error=>#<ActiveRecord::StatementInvalid: SQLite3::CorruptException: database disk image is malformed>, :exception=>["ActiveRecord::StatementInvalid", "SQLite3::CorruptException: database disk image is malformed"], :exception_object=>#<ActiveRecord::StatementInvalid: SQLite3::CorruptException: database disk image is malformed>}, error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"

In sqlite3 client.

sqlite> .open production-queue.sqlite3
sqlite> pragma integrity_check;
*** in database main ***
On tree page 523 cell 23: Rowid 146 out of order
NULL value in solid_queue_jobs.created_at
NULL value in solid_queue_jobs.updated_at
row 146 missing from index index_solid_queue_jobs_for_alerting
row 146 missing from index index_solid_queue_jobs_for_filtering
row 146 missing from index index_solid_queue_jobs_on_finished_at
row 146 missing from index index_solid_queue_jobs_on_active_job_id
row 146 missing from index index_solid_queue_jobs_on_class_name
NULL value in solid_queue_jobs.created_at
NULL value in solid_queue_jobs.updated_at
row 147 missing from index index_solid_queue_jobs_for_alerting
row 147 missing from index index_solid_queue_jobs_for_filtering
row 147 missing from index index_solid_queue_jobs_on_finished_at
row 147 missing from index index_solid_queue_jobs_on_active_job_id
row 147 missing from index index_solid_queue_jobs_on_class_name
NULL value in solid_queue_jobs.created_at
NULL value in solid_queue_jobs.updated_at
row 148 missing from index index_solid_queue_jobs_for_alerting
row 148 missing from index index_solid_queue_jobs_for_filtering
row 148 missing from index index_solid_queue_jobs_on_finished_at
row 148 missing from index index_solid_queue_jobs_on_active_job_id
row 148 missing from index index_solid_queue_jobs_on_class_name
NULL value in solid_queue_jobs.created_at
NULL value in solid_queue_jobs.updated_at
row 149 missing from index index_solid_queue_jobs_for_alerting
row 149 missing from index index_solid_queue_jobs_for_filtering
row 149 missing from index index_solid_queue_jobs_on_finished_at
row 149 missing from index index_solid_queue_jobs_on_active_job_id
row 149 missing from index index_solid_queue_jobs_on_class_name
Error: stepping, database disk image is malformed (11)
sqlite> pragma integrity_check;
*** in database main ***
On tree page 523 cell 23: Rowid 146 out of order
NULL value in solid_queue_jobs.created_at
NULL value in solid_queue_jobs.updated_at
row 146 missing from index index_solid_queue_jobs_for_alerting
row 146 missing from index index_solid_queue_jobs_for_filtering
row 146 missing from index index_solid_queue_jobs_on_finished_at
row 146 missing from index index_solid_queue_jobs_on_active_job_id
row 146 missing from index index_solid_queue_jobs_on_class_name
Error: stepping, database disk image is malformed (11)

Doing a .clone doesn’t seem to fix.

I’m not in “real” production and this is a job queue and thus somewhat destroyable, so I’m going to take that approach.

I’ve also seen similar corruption on my local development environment too akin to that mentioned by @marcoroth on X.

https://x.com/marcoroth_/status/1831045885423497223

In that case I just destroyed and recreated the file and moved on.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 85 (60 by maintainers)

Commits related to this issue

Most upvoted comments

OK, I understand what’s happening. Problems result when an inherited (from the parent process) database connection is sqlite3_close()ed or a prepared statement is sqlite3_finalize()ed in the child process.

In a Rails app it seems much more likely to be a statement being finalized because of the cached statements, but it can happen with the database objects as well.

I think we should be able to work around this now that I understand the mechanism.

Epic team work, all 🤘. Sqlite is going to be a much bigger role in Rails apps going forward.

Released https://github.com/sparklemotion/sqlite3-ruby/releases/tag/v2.1.0.rc2 addressing a performance regression in rc1.

OMG! You two are such absolute legends! @flavorjones you are a complete baller. @rosa you are a total magician. I am so grateful to get to work in the general vicinity of you both. I will buy you both some kind of drink in Toronto to show my thanks.

Git bisecting, this is the PR/commit where this behavior changed:

https://github.com/sparklemotion/sqlite3-ruby/pull/392 / https://github.com/sparklemotion/sqlite3-ruby/commit/0c24631d5b8c9b2e361b1a0bbfc1823a18793b71

which has to do with the lifecycle of database connections and prepared statements. Getting closer.

👋 Hey all. I spent a chunk of time yesterday trying to reproduce this. My hunch after reading this issue and How To Corrupt An SQLite Database File is that it might have to do with process forking.

So that’s where I focused my time, and it paid off. I’m able to easily reproduce at least some form of database corruption using nothing but active record and forking. Some caveats, though:

  • I can only reproduce this on Linux. I’m not yet sure why, but it may be because of sqlite’s specialized code for different operating systems.
  • This may not be the only problem with sqlite corruption and may not actually even address some of the observations in this thread. I’m mostly convinced that there are at least two separate issues being described above.

That said, here’s the ad-hoc repro script that reproduces corruption on my system:

https://gist.github.com/flavorjones/1f1dffa6bdd6ab81a227d10d73891f34

The broader context is that I run it in a vanilla rails app with a scaffolded Post model, and I run it like this:

while ./fork-safety.rb ; do echo again ; done

It exits with nonzero status if the sqlite integrity check fails. I see lots of exceptions (“disk I/O error”) but those don’t always result in corruption, so I run it in a loop and reliably reproduce database corruption in under a minute.

I will post a full Rails app repo later this morning, with more comments, etc. but the corruption only happens when BOTH of these conditions are true:

  • the parent has an open sqlite connection when it forks,
  • and the parent exits before the children have finished their work

So if the parent waits for the children to exit: no problem. If the parent closes its connections before it forks: no problem.

Please note that in this scenario the children aren’t even using the database connection inherited from the parent process – Rails is doing the right thing and creating new connections, as instructed in https://www.sqlite.org/howtocorrupt.html, and the problem still happens.

It’s still very early in the investigation, but my current hypothesis is that something is going on in shared memory space when the parent exits that then causes problems in the child processes. This may or may not be intended behavior but I’d like to isolate this with a reproduction in C and move the conversation upstream to the sqlite forum.

OK, I hacked on the sqlite3 adapter so that it closes database connections before forking, and that seems to prevent the data corruption and disk i/o errors. I think we just need to polish the patch and land it in Rails and everything will be OK! Stay tuned.

I’ve tried out the solid_queue_bughunt repo and it seems like it’s working OK (and I can see the warning messages from sqlite3-ruby in the log which means it’s doing something ✔). But the more scenarios we can test with the better. If you could just drop a note here if you’ve been able to test (or if you intend to test), I would ❤️ you forever.

FYI I have upgraded rubyvideo.dev with this latest version(https://github.com/adrienpoly/rubyvideo/commit/71ece9b9d678ee4cba1c929de8a9367ca9f9a0ba). It is now live in prod. So fare everything looks perfect.

Aww @fractaledmind you’re too kind! This was all @flavorjones, he’s the magician 🪄. Plus it’s me who’s beyond grateful to you and everyone here for the help, it’s a privilege to have people like you in the community 🙇🏻‍♀️ I’m definitely the one getting you drinks at Rails World! 😆 and Marco, Nick, Andy… 🥹🙏🏻

Repository with a full Rails app reproduction here: https://github.com/flavorjones/2024-09-13-sqlite-corruption

@rosa Yea im living on the edge and following main.

gem "rails", github: "npezza93/rails", branch: "union-fix"

with a database config of:

default: &default
  adapter: sqlite3
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  timeout: 5000

development:
  primary:
    <<: *default
    database: storage/dev.sqlite3
  queue:
    <<: *default
    migrations_paths: db/queue_migrate
    database: storage/queue_development.sqlite3

If/when you have a corrupted database, can you share the result of sqlite3 storage/development-queue.sqlite3 ‘pragma integrity_check;’

For sure! Never been so excited to get a corrupted database before 😅

were you running this via Puma or bin/jobs?

puma

And are your logs copied from log/development.log?

yup!

config

development:
  dispatchers:
    - polling_interval: 5
      batch_size: 500
  workers:
    - queues: "*"
      threads: 5
      processes: 5
      polling_interval: 2

production:
  dispatchers:
    - polling_interval: 1
      batch_size: 500
  workers:
    - queues: "*"
      threads: 6
      processes: 1
      polling_interval: 0.1

Yeah, this sounds like it might be what is occurring:

Do not even call sqlite3_close() on a database connection from a child process if the connection was opened in the parent. It is safe to close the underlying file descriptor, but the sqlite3_close() interface might invoke cleanup activities that will delete content out from under the parent, leading to errors and perhaps even database corruption.

If it helps, here’s how my pragma integrity_check looks like:

❯ sqlite3
SQLite version 3.43.2 2023-10-10 13:08:14
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open ./storage/development-queue.sqlite3
sqlite> pragma integrity_check;
row 1 missing from index index_solid_queue_processes_on_supervisor_id
row 2 missing from index index_solid_queue_processes_on_supervisor_id
row 3 missing from index index_solid_queue_processes_on_supervisor_id
wrong # of entries in index index_solid_queue_processes_on_supervisor_id
sqlite>

Changed direction, here’s the latest plan, I’d love feedback:

See https://github.com/rails/rails/pull/52931 which should address at least one of the issues discussed in this thread (fork-safety). I’d love to get some feedback on it!

Ok, I finally could reproduce this with @flavorjones’s test on macOS. Yesterday when I was testing that I didn’t realise I was running this version of SQLite3

1.7.2: arm64-darwin

Today, I’ve got the corruption error with both:

2.0.4: arm64-darwin
2.0.4: x86_64-darwin

I’m doing other tests now with different versions, there’s also a difference if I reduce the number of children to 3 like yesterday.

Update: yes, the number of children makes a difference. With N=10, I get the corruption with older versions of the sqlite3 gem (tested with 1.5.0).

~One more note amending what I wrote above: I can sometimes reproduce this even when the parent has closed all its connections, and even when it has created zero connections. I honestly don’t know what to make of this fact yet and it seems like absolutely bonkers spooky-action-at-a-distance.~

Ignore this, it was a procedural mistake on my part.

Just a quick update on this one: I’ve been busy the last couple of days with other work stuff but I plan to come back to this tomorrow. I’ve spent more time learning about how Active Record prevents connections from leaking across forks as well, as this was something I wasn’t familiar with (I only knew it was supposed to handle it). I’ll also test a bit more #337 in production and will merge it, and then will dedicate most of the effort to try to reproduce the original error with the real corruption.

I think there are two issues, this SQLite3::CorruptException I hit just now is closer to what @alvernier is describing. It happened shortly after waking up my mac, which happened to me for the first time now. The other ones I encountered I could easily reproduce and didn’t involve waking up my MacBook.

But after it crashed this time I could run rails s again and it wasn’t complaining about the corrupted file. The pragma check is confirming that the database is actually in tact.

❯ sqlite3
SQLite version 3.43.2 2023-10-10 13:08:14
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open ./storage/development-queue.sqlite3
sqlite> pragma integrity_check;
ok

Which leads me to believe that these are two separate issues having very similar symptoms.

App: RubyVideo on fb0a8c7 Ruby: 3.3.4 Rails: 7.2.0 SolidQueue: 0.5.0 sqlite3: 3.43.2 2023-10-10 13:08:14 1b37c146ee9ebb7acd0160c0ab1fd11017a419fa8a3187386ed8cb32b709aapl (64-bit) sqlite3 gem: sqlite3-2.0.3-x86_64-darwin

Here are the full-logs, from rails s to ctrl-c-ing to exception.

I tried to annotate them to give more context. Note: My system time is on CEST (UTC+2), db queries are on UTC.

Time (CEST) What happened Logs Line Number
~21:02:10 Starting Rails server using rails s L2
21:04:21 First Request hits Rails server L54
~21:04:43 I leave my MacBook L164
10 mins later (around 21:14:xx Displays should have turned off themesleves (according to my macOS settings) around L264
~23:23:xx I return to my MacBook and unlock it, The /feed.xml is from a local RSS subscription in the RSS reader app, I think it did fetch the file again as soon as I unlocked my mac L707
23:23:xx I return to my terminal and hit Ctrl-C the first time L720
23:23:xx Ctrl-C for the second time L721
23:23:xx Ctrl-C for the third time L727
23:23:xx Transaction rollback L731
23:23:xx SQLite3::CorruptException is thrown L735

I just got a SQLite3::CorruptException shortly after waking up my Mac 👀 Going to collect whatever could be useful…

One weird thing I noticed, my mac was lagging for a bit and then I saw the exception. My guess is that it could have to do when the system is running low on available resources.

@rosa Awesome ill give the branch a try!

I can reproduce this issue after Mac hibernation with this config:

  • Mac Sonoma 14.6.1 / Intel
  • Solid_queue : 0.8.2
  • Rails : main
  • Dedicated Sqlite DB
  • Using puma plugin
  • SQlite version 3.43.2 2023-10-10 13:08:14 1b37c146ee9ebb7acd0160c0ab1fd11017a419fa8a3187386ed8cb32b709aapl (64-bit)
  • sqlite3 storage/queue.sqlite3 “PRAGMA integrity_check” returns ok
  • log solidqueue.log

note:

  • rails and solid_queue don’t share the same time zone (don’t know why)
  • my configuration is mostly default settings from rails ‘main’

config:

default: &default
   dispatchers:
     - polling_interval: 1
       batch_size: 500
       recurring_tasks:
         my_periodic_job:
           class: CheckJob
           args:
           schedule: every 10 min
   workers:
     - queues: "*"
       threads: 3
       processes: 1
       polling_interval: 0.1

 development:
  <<: *default

 test:
  <<: *default

Edit: sqlite version

Just a small reminder for years of debugging in the dark: save your brain cycles and energy trying to find the problem. Definitionally we have missing info and/or faulty assumptions somewhere. The exclusive focus for us all should be creating a reproduction. I promise we won’t solve this without that. So containing to explore the space of scenarios in an attempt to deterministically reproduce is going to be the highest leverage activity.

That reminds me that was my hunch when I saw this a while back. I upgrade aggressively and I’ve been conference prepping, so I haven’t seen this personally in a while. But I recall wondering if it was related to closing the laptop.

I think im on to something. Just had it happen to me. Cant quite reproduce reliably yet but i think it may have something to do with me keeping the server running with the puma plugin running and closing my laptop for some period of time. Cant confirm yet but just a hunch. Will report back if i mind reliable instructions. Heres the log. It’s weird that there are rollbacks happening trying to update the Process model and then it corrupts.

Turbo::StreamsChannel is transmitting the subscription confirmation
Turbo::StreamsChannel is streaming from Z2lkOi8vcWlyYS9TZWN1cml0eS80Nw:chart:1D
Unsubscribing from channel: {"channel":"Turbo::StreamsChannel","signed_stream_name":"IloybGtPaTh2Y1dseVlTOVRaV04xY21sMGVTODBOdzpjaGFydDoxRCI=--6b7a8177c089474a55c40174ae74943ecba61bc5effaf1d922cc00e95ded31a4"}
Turbo::StreamsChannel stopped streaming from Z2lkOi8vcWlyYS9TZWN1cml0eS80Nw:chart:1D
Turbo::StreamsChannel is transmitting the subscription confirmation
Turbo::StreamsChannel is streaming from Z2lkOi8vcWlyYS9TZWN1cml0eS80Nw:chart:1D
  SQL (0.2ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (3.9ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:20:18.968432"], ["id", 93]]
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.1ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:20:19.144763"], ["id", 95]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.6ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:20:19.164246"], ["id", 96]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.7ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:20:19.169932"], ["id", 98]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (8.7ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (9.5ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:20:19.164249"], ["id", 97]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (13.8ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (15.1ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:20:19.164685"], ["id", 94]]
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.7ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:20:19.196651"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.5ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:21:19.012875"], ["id", 93]]
  TRANSACTION (0.0ms)  COMMIT TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.7ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:21:19.160688"], ["id", 95]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.6ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:21:19.176302"], ["id", 96]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.1ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:21:19.177137"], ["id", 98]]
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.8ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:21:19.184487"], ["id", 94]]
  TRANSACTION (0.0ms)  COMMIT TRANSACTION
  SQL (3.6ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (4.3ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:21:19.184518"], ["id", 97]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.0ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:21:19.201697"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SolidQueue::Process Load (0.1ms)  SELECT "solid_queue_processes".* FROM "solid_queue_processes" WHERE "solid_queue_processes"."last_heartbeat_at" <= ? ORDER BY "solid_queue_processes"."id" ASC LIMIT ?   [["last_heartbeat_at", "2024-09-06 14:17:18.947007"], ["LIMIT", 50]]
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Destroy (1.1ms)  DELETE FROM "solid_queue_processes" WHERE "solid_queue_processes"."id" = ?  [["id", 8]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error deregistering Supervisor (4.8ms)  process_id: 8, pid: 87668, hostname: "Nicks-MacBook-Air.local", name: "supervisor-fb2dc5791db13f37a778", last_heartbeat_at: "2024-09-05T23:20:38-04:00", claimed_size: nil, pruned: true, error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
SolidQueue-0.8.2 Prune dead processes (30.5ms)  size: 13
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (2.0ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:22:19.021586"], ["id", 93]]
  TRANSACTION (0.0ms)  COMMIT TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:22:19.165340"], ["id", 95]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.5ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:22:19.181037"], ["id", 96]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.9ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:22:19.182902"], ["id", 98]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.5ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:22:19.192213"], ["id", 94]]
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:22:19.194242"], ["id", 97]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.1ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:22:19.210680"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.2ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:23:19.027648"], ["id", 93]]
  TRANSACTION (0.0ms)  COMMIT TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.3ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:23:19.173473"], ["id", 95]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:23:19.184874"], ["id", 96]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.5ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:23:19.187570"], ["id", 98]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:23:19.199510"], ["id", 94]]
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:23:19.202226"], ["id", 97]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:23:19.214210"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.2ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:24:19.033318"], ["id", 93]]
  TRANSACTION (0.0ms)  COMMIT TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (2.1ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:24:19.181729"], ["id", 95]]
  TRANSACTION (0.1ms)  ROLLBACK TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SolidQueue::Process Update (1.8ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:24:19.187835"], ["id", 96]]
  TRANSACTION (0.1ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SolidQueue::Process Update (0.7ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:24:19.194634"], ["id", 98]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.9ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:24:19.205474"], ["id", 94]]
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SQL (1.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (2.5ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:24:19.206692"], ["id", 97]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.0ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:24:19.219473"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.2ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (3.2ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:25:19.053217"], ["id", 93]]
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (3.1ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:25:19.195502"], ["id", 95]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (1.3ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (2.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:25:19.212315"], ["id", 94]]
  TRANSACTION (0.2ms)  COMMIT TRANSACTION
  SQL (2.6ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (15.1ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:25:19.201020"], ["id", 98]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (16.3ms)  BEGIN immediate TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SolidQueue::Process Update (17.1ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:25:19.201014"], ["id", 96]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (7.6ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (13.9ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:25:19.218068"], ["id", 97]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (3.9ms)  BEGIN immediate TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SolidQueue::Process Update (10.3ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:25:19.228835"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.6ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:26:19.065500"], ["id", 93]]
  TRANSACTION (0.0ms)  COMMIT TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.5ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:26:19.217067"], ["id", 95]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:26:19.218612"], ["id", 94]]
  TRANSACTION (0.0ms)  COMMIT TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.1ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:26:19.223827"], ["id", 98]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.6ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:26:19.226618"], ["id", 96]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:26:19.234613"], ["id", 97]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.5ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:26:19.242735"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SolidQueue::Process Load (0.3ms)  SELECT "solid_queue_processes".* FROM "solid_queue_processes" WHERE "solid_queue_processes"."last_heartbeat_at" <= ? ORDER BY "solid_queue_processes"."id" ASC LIMIT ?   [["last_heartbeat_at", "2024-09-06 14:22:18.983585"], ["LIMIT", 50]]
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Destroy (1.5ms)  DELETE FROM "solid_queue_processes" WHERE "solid_queue_processes"."id" = ?  [["id", 8]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error deregistering Supervisor (5.5ms)  process_id: 8, pid: 87668, hostname: "Nicks-MacBook-Air.local", name: "supervisor-fb2dc5791db13f37a778", last_heartbeat_at: "2024-09-05T23:20:38-04:00", claimed_size: nil, pruned: true, error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
SolidQueue-0.8.2 Prune dead processes (13.7ms)  size: 13
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.8ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:27:19.069270"], ["id", 93]]
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SolidQueue::Semaphore Pluck (0.2ms)  SELECT "solid_queue_semaphores"."id" FROM "solid_queue_semaphores" WHERE "solid_queue_semaphores"."expires_at" < ? ORDER BY "solid_queue_semaphores"."id" ASC LIMIT ?  [["expires_at", "2024-09-06 14:27:19.140496"], ["LIMIT", 500]]
  SolidQueue::BlockedExecution Pluck (0.2ms)  SELECT DISTINCT "solid_queue_blocked_executions"."concurrency_key" FROM "solid_queue_blocked_executions" WHERE "solid_queue_blocked_executions"."expires_at" < ? LIMIT ?  [["expires_at", "2024-09-06 14:27:19.143734"], ["LIMIT", 500]]
SolidQueue-0.8.2 Unblock jobs (1.9ms)  limit: 500, size: 0
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.5ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:27:19.221337"], ["id", 95]]
  TRANSACTION (0.1ms)  ROLLBACK TRANSACTION
  SQL (2.7ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (3.7ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:27:19.224777"], ["id", 94]]
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SQL (1.4ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (2.8ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:27:19.229198"], ["id", 98]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.2ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.3ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:27:19.233770"], ["id", 96]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.0ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:27:19.241697"], ["id", 97]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.2ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:27:19.250172"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (1.3ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (3.2ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:28:19.080873"], ["id", 93]]
  TRANSACTION (0.2ms)  COMMIT TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.7ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:28:19.234057"], ["id", 94]]
  SQL (2.9ms)  BEGIN immediate TRANSACTION
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SolidQueue::Process Update (4.7ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:28:19.234057"], ["id", 95]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SolidQueue::Process Update (1.0ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:28:19.240062"], ["id", 98]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (1.3ms)  BEGIN immediate TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SolidQueue::Process Update (2.7ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:28:19.240870"], ["id", 96]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.9ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:28:19.246019"], ["id", 97]]
  TRANSACTION (0.1ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.1ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:28:19.257539"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (1.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (2.9ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:29:19.091749"], ["id", 93]]
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:29:19.245256"], ["id", 94]]
  TRANSACTION (0.1ms)  COMMIT TRANSACTION
  SQL (2.7ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (3.8ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:29:19.245256"], ["id", 98]]
  TRANSACTION (0.1ms)  ROLLBACK TRANSACTION
  SQL (4.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (5.3ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:29:19.250051"], ["id", 97]]
  TRANSACTION (0.1ms)  ROLLBACK TRANSACTION
  SQL (12.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (12.9ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:29:19.247287"], ["id", 95]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (9.4ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (10.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:29:19.252059"], ["id", 96]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.8ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:29:19.265814"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.2ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (2.3ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:30:19.101218"], ["id", 93]]
  TRANSACTION (0.2ms)  COMMIT TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.3ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:30:19.255702"], ["id", 94]]
  TRANSACTION (0.2ms)  COMMIT TRANSACTION
  SQL (0.3ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (2.6ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:30:19.257937"], ["id", 98]]
  TRANSACTION (0.1ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.2ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (2.3ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:30:19.267211"], ["id", 97]]
  TRANSACTION (0.1ms)  ROLLBACK TRANSACTION
  SQL (2.7ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (4.0ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:30:19.268574"], ["id", 96]]
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  TRANSACTION (0.1ms)  ROLLBACK TRANSACTION
  SQL (3.4ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (4.2ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:30:19.270769"], ["id", 95]]
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (2.7ms)  BEGIN immediate TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SolidQueue::Process Update (3.9ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:30:19.273699"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
SolidQueue-0.8.2 Error in thread (0.0ms)  error: "ActiveRecord::StatementInvalid SQLite3::CorruptException: database disk image is malformed"
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.8ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:31:19.112942"], ["id", 93]]
  TRANSACTION (0.0ms)  COMMIT TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.5ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:31:19.264649"], ["id", 94]]
  TRANSACTION (0.0ms)  COMMIT TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.3ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:31:19.272308"], ["id", 98]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (1.8ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:31:19.278502"], ["id", 97]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:31:19.287002"], ["id", 96]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SQL (3.5ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (4.3ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:31:19.281150"], ["id", 95]]
  TRANSACTION (0.1ms)  ROLLBACK TRANSACTION
  SQL (0.0ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Update (0.4ms)  UPDATE "solid_queue_processes" SET "last_heartbeat_at" = ? WHERE "solid_queue_processes"."id" = ?  [["last_heartbeat_at", "2024-09-06 14:31:19.287669"], ["id", 99]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION
  SolidQueue::Process Load (0.2ms)  SELECT "solid_queue_processes".* FROM "solid_queue_processes" WHERE "solid_queue_processes"."last_heartbeat_at" <= ? ORDER BY "solid_queue_processes"."id" ASC LIMIT ?   [["last_heartbeat_at", "2024-09-06 14:27:19.003458"], ["LIMIT", 50]]
  SQL (0.1ms)  BEGIN immediate TRANSACTION
  SolidQueue::Process Destroy (1.3ms)  DELETE FROM "solid_queue_processes" WHERE "solid_queue_processes"."id" = ?  [["id", 8]]
  TRANSACTION (0.0ms)  ROLLBACK TRANSACTION

I upgraded SolidQueue to 0.6.0 so I could later upgrade to 0.8.x to see if the issue is still present on the latest version.

But I couldn’t reproduce it on 0.6.0. And now, after downgrading again, I can’t reproduce it on 0.5.0 anymore weirdly enough 🤔

Prior to upgrading to 0.6.0 I was able to reliably reproduce it.

Is there any chance that this is dependent on the sqlite3 gem variant you get?

I’m running the x86_64-darwin one (and I assume @andycroll is probably also running a x86_64-* variant in production) whereas most of you are probably running a arm64-* variant on your local dev machines.

Also, here is a one-liner to check the queue database integrity: sqlite3 storage/development-queue.sqlite3 'pragma integrity_check;'

@marcoroth: I created this repo to hopefully help us find a reproduction: https://github.com/fractaledmind/solid_queue_bughunt

You will see that I have a LongRunningQueryJob that I enqueue automatically once Solid Queue is loaded. I am trying to ctrl + c twice once the job starts up such that the Rails process is killed and the job dies. But, the job always resolves. I’m curious what your experience is. Can you get everything to stop mid-operation? Or does the job eventually resolve for you to?

You can see if the job eventually resolves by just waiting 5 seconds or so after you kill the Rails process and waiting for logs to print. All you have to do is bin/rails s and everything goes automatically.

You will see I have commented out automatically killing the Rails server process. I was trying that as well. Still, the job resolves. My hunch is that it is/was somehow possible to force Solid Queue to not stop gracefully and if a job was running and connected to the database, that could corrupt. But I am not sure. Maybe if we all work on this reproduction repo, we can hunt it down.

Ohhhh, thanks a lot @fractaledmind. That’d make perfect sense as the culprit! I thought Rails would handle this properly and wouldn’t reuse the same connection but I need to dig more.

I haven’t been able to dig in myself yet, but after reading this: https://www.sqlite.org/howtocorrupt.html and knowing the bits that I know about the supervisor architecture, I was first drawn to:

2.6. Carrying an open database connection across a fork()