solid_queue: undefined method `supervisees`for nil

https://github.com/rails/solid_queue/blame/c521c6d47d10abeaf076a81d9af29e80eb2b11c7/lib/solid_queue/supervisor.rb#L174

probably should look something like process&.supervisees.find_by... or

if registered_process = process.supervisees.find_by(name: terminated_fork.name) rescue false

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

I just got this error again, this time I saved some additional events from the logs immediately before the error.

Just posting it here so that I can come back to debug this later.

13:22:17 web.1         | SolidQueue-1.1.2 Shutdown Dispatcher (1.6ms)  pid: 79216, hostname: "wheeljack", process_id: nil, name: "dispatcher-a281b20f5a6841dec145", polling_interval: 1, batch_size: 500, concurrency_maintenance_interval: 600
13:22:17 web.1         |   SolidQueue::Semaphore Pluck (27.2ms)  SELECT "solid_queue_semaphores"."id" FROM "solid_queue_semaphores" WHERE "solid_queue_semaphores"."expires_at" < '2025-01-13 06:22:17.669247' ORDER BY "solid_queue_semaphores"."id" ASC LIMIT 500 /*application='ExampleApp'*/
13:22:18 web.1         | SolidQueue-1.1.2 Replaced terminated Worker (4.8ms)  pid: 79217, status: 0, pid_from_status: 79217, signaled: false, stopsig: nil, termsig: nil, hostname: "wheeljack", name: "worker-4d5487c9585de0b0676e"
13:22:18 web.1         | SolidQueue-1.1.2 Shutdown Supervisor (1.6ms)  pid: 79205, hostname: "wheeljack", process_id: nil, name: "supervisor-58a3a355f1fe2b033ab7"
13:22:18 web.1         | ** [Honeybadger] Reporting error id=55300755-99d1-47b2-a451-2a65d87e4074 level=1 pid=79205
13:22:18 web.1         | ** [Honeybadger] Success ⚡ Development mode is enabled; this error will be reported if it occurs after you deploy your app. id=55300755-99d1-47b2-a451-2a65d87e4074 level=1 pid=79205
13:22:18 web.1         | /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:174:in `handle_claimed_jobs_by': undefined method `supervisees' for nil (NoMethodError)
13:22:18 web.1         |
13:22:18 web.1         |         if registered_process = process.supervisees.find_by(name: terminated_fork.name)
13:22:18 web.1         |                                        ^^^^^^^^^^^^
13:22:18 web.1         | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:166:in `block in replace_fork'
13:22:18 web.1         | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/notifications.rb:210:in `block in instrument'

... the same error as before ...

Just found this issue. I only have the occassional jobs to send an email. Nothing that adds to load.

Environment information

  • Development environment
  • Procfile has this line to start jobs -jobs: bin/jobs start
  • The only config related to solidqueue in my development.rb are these lines
  config.active_job.queue_adapter = :solid_queue
  config.solid_queue.connects_to = { database: { writing: :queue } }

Log output

10:13:45 jobs.1        | /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:174:in `handle_claimed_jobs_by': undefined method `supervisees' for nil (NoMethodError)
10:13:45 jobs.1        |
10:13:45 jobs.1        |         if registered_process = process.supervisees.find_by(name: terminated_fork.name)
10:13:45 jobs.1        |                                        ^^^^^^^^^^^^
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:166:in `block in replace_fork'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/notifications.rb:210:in `block in instrument'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0/lib/active_support/notifications.rb:210:in `instrument'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue.rb:67:in `instrument'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:163:in `replace_fork'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:143:in `block in reap_and_replace_terminated_forks'
10:13:45 jobs.1        | 	from <internal:kernel>:187:in `loop'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:139:in `reap_and_replace_terminated_forks'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:67:in `block in supervise'
10:13:45 jobs.1        | 	from <internal:kernel>:187:in `loop'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:60:in `supervise'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:36:in `start'
10:13:45 jobs.1        | 	from <internal:kernel>:90:in `tap'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/supervisor.rb:14:in `start'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/solid_queue-1.1.2/lib/solid_queue/cli.rb:26:in `start'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
10:13:45 jobs.1        | 	from /Users/akash/.asdf/installs/ruby/3.3.5/lib/ruby/gems/3.3.0/gems/thor-1.3.2/lib/thor/base.rb:584:in `start'
10:13:45 jobs.1        | 	from bin/jobs:6:in `<main>'
10:13:46 jobs.1        | exited with code 1

@tahirwaseer, no, that should be ok, what I mean is that in production usually your processes won’t go “to sleep” like if you have them running in your computer that might be suspended after some time inactive 😅

These are almost all the logs. other didn’t look relevant. It keeps processing the jobs and after a while i get this. Haven’t figured out the exact reason.

One more thing about the setup:

I’ve this in my puma.rb: max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }

And I’m running four workers with three threads each which exceeds puma threads. Not sure if this could cause anything like that.

Got another one:

2aad22750000-2aad22760000 rw-p 00000000 00:00 0 2aad22770000-2aad22780000 rw-p 00000000 00:00 0 2aad22790000-2aad227a0000 rw-p 00000000 00:00 0 2aad227b0000-2aad227c0000 rw-p 00000000 00:00 0 2aad227d0000-2aad227e0000 rw-p 00000000 00:00 0 2aad227e7000-2aad2281a000 r–s 00000000 00:53 2836918 /usr/local/bin/ruby 2aad2281a000-2aad23992000 r–s 00000000 00:53 2964141 /usr/local/lib/libruby.so.3.2.0 2aad23992000-2aad239b7000 r–s 00000000 00:53 470233 /lib/x86_64-linux-gnu/libpthread-2.31.so 2aad239b7000-2aad23b89000 r–s 00000000 00:53 470188 /lib/x86_64-linux-gnu/libc-2.31.so 555555556000-555555557000 r–p 00000000 00:53 2836918 /usr/local/bin/ruby 555555557000-555555558000 r-xp 00001000 00:53 2836918 /usr/local/bin/ruby 555555558000-555555559000 r–p 00002000 00:53 2836918 /usr/local/bin/ruby 555555559000-55555555a000 r–p 00002000 00:53 2836918 /usr/local/bin/ruby 55555555a000-55555555b000 rw-p 00003000 00:53 2836918 /usr/local/bin/ruby 55555555b000-5555596d0000 rw-p 00000000 00:00 0 5555596d0000-555559ec0000 rw-p 00000000 00:00 0 ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall]

qemu: uncaught target signal 6 (Aborted) - core dumped Time taken to download and set image for product_image f896458d-425f-4412-aed2-aa94b3c8847a: 4.836300586 seconds Time taken to download and set image for product_image 5bf46c41-1170-485a-a0df-1e69c82600a6: 4.656792128 seconds Time taken to download and set image for product_image 87420dce-35d8-49d6-8a1b-51f3c67176e6: 4.735127419 seconds /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:174:in handle_claimed_jobs_by': undefined method supervisees’ for nil:NilClass (NoMethodError)

    if registered_process = process.supervisees.find_by(name: terminated_fork.name)
                                   ^^^^^^^^^^^^
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:166:in `block in replace_fork'
from /usr/local/bundle/gems/activesupport-7.1.2/lib/active_support/notifications.rb:206:in `block in instrument'
from /usr/local/bundle/gems/activesupport-7.1.2/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
from /usr/local/bundle/gems/activesupport-7.1.2/lib/active_support/notifications.rb:206:in `instrument'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue.rb:67:in `instrument'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:163:in `replace_fork'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:143:in `block in reap_and_replace_terminated_forks'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:139:in `loop'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:139:in `reap_and_replace_terminated_forks'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:67:in `block in supervise'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:60:in `loop'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:60:in `supervise'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:36:in `start'
from <internal:kernel>:90:in `tap'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/supervisor.rb:14:in `start'
from /usr/local/bundle/gems/solid_queue-1.1.0/lib/solid_queue/cli.rb:26:in `start'
from /usr/local/bundle/gems/thor-1.3.2/lib/thor/command.rb:28:in `run'
from /usr/local/bundle/gems/thor-1.3.2/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/local/bundle/gems/thor-1.3.2/lib/thor.rb:538:in `dispatch'
from /usr/local/bundle/gems/thor-1.3.2/lib/thor/base.rb:584:in `start'
from bin/jobs:6:in `<main>'