Repository navigation
Closed
Description
I returned to a project I was working on last month and couldn't start bin/jobs
▶ bin/jobs
SolidQueue-1.2.4 Register Supervisor (30.3ms) pid: 46471, hostname: "<HOST>", process_id: 561, name: "supervisor-b60576c40bcf94f63fc1"
SolidQueue-1.2.4 Fail claimed jobs (91.4ms)
SolidQueue-1.2.4 Started Supervisor (154.1ms) pid: 46471, hostname: "<HOST>", process_id: 561, name: "supervisor-b60576c40bcf94f63fc1"
/Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/connection_adapters/abstract/quoting.rb:87:in 'ActiveRecord::ConnectionAdapters::Quoting#quote': can't quote SolidQueue::Processes::ProcessMissingError (TypeError)
raise TypeError, "can't quote #{value.class.name}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/connection_adapters/sqlite3/quoting.rb:62:in 'ActiveRecord::ConnectionAdapters::SQLite3::Quoting#quote'
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/arel/collectors/substitute_binds.rb:20:in 'Arel::Collectors::SubstituteBinds#add_bind'
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/arel/visitors/to_sql.rb:747:in 'Arel::Visitors::ToSql#visit_ActiveModel_Attribute'
...
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:43:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#to_sql_and_binds'
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/connection_adapters/abstract/database_statements.rb:74:in 'ActiveRecord::ConnectionAdapters::DatabaseStatements#select_all'
...
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/relation/finder_methods.rb:118:in 'ActiveRecord::FinderMethods#find_by!'
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/relation.rb:303:in 'block in ActiveRecord::Relation#create_or_find_by!'
...
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/relation.rb:294:in 'ActiveRecord::Relation#create_or_find_by!'
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/activerecord-8.1.1/lib/active_record/querying.rb:24:in 'ActiveRecord::Querying#create_or_find_by!'
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.4/app/models/solid_queue/job/retryable.rb:19:in 'SolidQueue::Job::Retryable#failed_with'
from /Users/ttilberg/.asdf/installs/ruby/3.4.7/lib/ruby/gems/3.4.0/gems/solid_queue-1.2.4/app/models/solid_queue/claimed_execution.rb:93:in 'block in SolidQueue::ClaimedExecution#failed_with'
I asked for help from Claude to diagnose, and this seems to make sense:
In
| def failed_with(exception) |
def failed_with(exception)
FailedExecution.create_or_find_by!(job_id: id, exception: exception)
endIf find_by is triggered, it includes exception, which is not a column in the db. The field in the DB is error:
| t.text "error" |
Claude has helped me describe why this seems rare and no one has reported it:
- A job fails with an exception, creating a
FailedExecutionrecord - User retries the failed job (e.g., via Mission Control)
- The retry removes the
FailedExecutionand re-queues the job - A worker claims the job, creating a
ClaimedExecution - The job fails again, creating a new
FailedExecutionrecord - The worker process dies/crashes before cleaning up the
ClaimedExecution - When SolidQueue starts up, it tries to fail the orphaned
ClaimedExecutionwithProcessMissingError - Since a
FailedExecutionalready exists for this job_id, the error occurs
Without having the overall system in mind, I'm not sure if the correct fix is to move exception into the on create block:
FailedExecution.create_or_find_by!(job_id: id) {|j| j.exception = exception } # exception virtual attror use the error column instead
def failed_with(error)
FailedExecution.create_or_find_by!(job_id: id, error: error)
endI think the first one is probably most appropriate, since you'd only want a single record per id.
Metadata
Metadata
Assignees
Labels
No labels
Activity
rosa commentedon Jan 8, 2026
Huh, this is so strange! I think Claude's diagnosis is not correct 🤔 In particular, this part:
On 5, the
ClaimedExecutionis deleted in the same transaction as theFailedExecutionrecord is created. This means that on 6, there's noClaimedExecutionto clean up. It's either one or the other: if there's aClaimedExecution, there can't be aFailedExecution, and the other way around.Is it possible you've manually done something that could bring the system into this state, of having both a
ClaimedExecutionand aFailedExecutionfor the same job?ttilberg commentedon Jan 8, 2026
😅 You wouldn't believe how much time I went back and forth asking to try to help sort this out so as to not embarrass myself bothering you with AI slop haha, particularly since no one else seems to have had this come up. But trying to create a reproduction of what it described was all sorts of crazy because of the unique conditions. I felt it's reasoning seemed plausible :X
Unfortunately I don't know what may have happened. The resolution to get me back up involved manually deleting records from the claimed_executions, and I think the failed_executions table.
It's in a scraping project, so there's lots of failures expected, and it's in my dev env, so thing might have gotten killed in an unclean way. I don't know if that's helpful at all.
Feel free to close if you think that create_or_find_by statement looks fine with the
exceptionattribute!Thanks Rosa!
rosa commentedon Jan 8, 2026
Oh, no worries at all! This is a tricky one, and your report did expose that the
create_or_find_bystatement there is wrong. It should simply becreate🤔. I think I usedcreate_or_find_bybecause it's what I was using with the other execution types, and I just copied it from there, but it doesn't make sense there. I'll change that!ttilberg commentedon Jan 26, 2026
I came into this state again today, and I've sliced off a copy of the queue db in case you'd like to review.
Notably regarding:
I think you're saying there should not be a case where there's a job id in both claimed and failed tables, but I believe I'm seeing that:
As to how I got here, I don't exactly know:
delete from solid_queue_claimed_executions;to clear the table, which allowed to get past this error.I don't understand the system well enough to know if this is still meaningful beyond what you've already established.
Let me know if you want a copy of my queue db, and how I can send it privately.
rosa commentedon Jan 26, 2026
What a mystery! Yes, I have no idea how you could arrive at this situation. You said:
How are you doing this? Is it just a normal Rails app where you enqueue jobs via Active Job... or? And are you using any of the
SolidQueueclasses in your app somehow?ttilberg commentedon Jan 26, 2026
Very straightforward ActiveJob in general. Only funny business is that it gets started and stopped (sometimes unexpectedly) more often than a typical server-based deployment. I use Mission Control to monitor the jobs.
Would this come up if at times there were two separate processes acting on the job queue? There have been some times where I was running
bin/jobsnot realizing it already had jobs running. Though, from what you’ve described, I don’t think that should make a difference.rosa commentedon Jan 26, 2026
Right, that shouldn't make any difference...
This is so puzzling! And I'd also expect this to happen to other people because quite a few folks run Solid Queue in their local machines with frequent unceremonious shutdowns, like the laptop going to sleep. Some of those triggered some code changes in the past to avoid or fix weird data statuses like this one, but nobody else has encountered this particular one.
I must be missing something here. Maybe the bug is in Mission Control? Do you recall if you did anything there before this last occurrence?
lfdebrux commentedon Jan 28, 2026
We're seeing this error in a test environment in AWS whenever we try and start a queue worker server.
We additionally get an error about duplicate records for failed executions.
It seems to get into a loop of trying to record the failed execution and failing, until the task is killed in AWS for being unhealthy.
I've dumped the logs of one task below, just in case it's helpful...
Logs of failed start of SolidQueue
I'm not sure yet what has caused this failure to start happening, I'll keep digging, because it is a test environment it's possible that the task was not shutdown cleanly...
Sorry if this is not helpful information, just thought I'd share that this might not be a one-off!
Fix crash when recording a failed execution for a job that already ha…
Fix crash when recording a failed execution for a job that already ha…
Fix crash when recording a failed execution for a job that already ha…
Fix crash when recording a failed execution for a job that already ha…