Sidekiq: NameError: uninitialized constant Sidekiq::Extensions::DelayedClass

Created on 4 Mar 2019  Â·  6Comments  Â·  Source: mperham/sidekiq

Hi everybody,
I'm facing a NameError: uninitialized constant Sidekiq::Extensions::DelayedClass in a random way.

I am running a Rails Application with docker containers.
I have 4 services: redis, postgres, rails and sidekiq.
Sidekiq and Rails both use the same rails image..

Everything worked well until some times ago..

I don't notice when, but now, everything work only for a couple of hours..
Then I got this error in my Sidekiq container.

I tried with a completely new setup (I mean with no prior volume or existing container).
When I launched everything, my app (and the jobs for mails) works well, then after a moment I got this error.

For example yesterday I restarted all the services in new instances, everything worked and all of sudden I got this error.

Here is the log from the last working event (an email sent yesterday at 19:33:35).
The first error happened at 06:33:47 and then it's repeated with random frequency (sometimes 10 sec, sometimes 2 minutes, sometimes 10 minutes, sometimes 1 hour and then again 2 minutes..)

Sometimes at the end of a job I may schedule the same job 7 days later.. I don't know if this has a connection with the error.

Does anyone already experienced this issue?

I saw on the internet that eager loading may resolve this issue, but I don't know where to put this configuration..

Also why in the past I never encountered this issue.

Ruby version: 2.6.1
Sidekiq version(s): 5.2.3

sidekiq.yml

:concurrency: 1
:queues:
  - default
  - mailers

initializers/sidekiq.rb

Sidekiq.configure_server do |config|
  config.redis = { url: 'redis://redis:6379/0' }
end

Sidekiq.configure_client do |config|
  config.redis = { url: 'redis://redis:6379/0' }
end

Most helpful comment

require 'sidekiq/web' is required in config/routes.rb
```
require 'sidekiq/web'

Rails.application.routes.draw do
mount Sidekiq::Web => '/sidekiq'

end

All 6 comments

I don't know what would cause this. If you can create a small app which reproduces the problem, I would be happy to look.

Thank you,
I'll be honest I don't even know if I can reproduce this elsewhere and I don't even know what's happening and what this error even mean..
Can you explain what this error mean, what sidekiq is expecting?
When googling this error I saw people talking about "eager loading", is it a configuration I should put on rails config or sidekiq config?
Again thank you for your time..

image

I had this error, too.

I created my docker container of sidekiq 5 days ago, but this job was created at 1 year ago??

This is my sidekiq initializer

# frozen_string_literal: true

redis_conn = proc {
  Redis.new(url: ENV['REDIS_URL'])
}

Sidekiq.configure_server do |config|
  config.redis = ConnectionPool.new(timeout: 5, size: Sidekiq.options[:concurrency] + 5, &redis_conn)
end

Sidekiq.configure_client do |config|
  config.redis = ConnectionPool.new(timeout: 5, size: Sidekiq.options[:concurrency] + 5, &redis_conn)
end

Have you read the second paragraph on the Delayed wiki page?

https://github.com/mperham/sidekiq/wiki/Delayed-extensions

They are disabled by default in Sidekiq 5+. Use Sidekiq::Extensions.enable_delay! to turn them on.

On Mar 8, 2019, at 04:12, 9to6 notifications@github.com wrote:

I had this error, too.

I created my docker container of sidekiq 5 days ago, but this job was created at 1 year ago??

This is my sidekiq initializer

frozen_string_literal: true

redis_conn = proc {
Redis.new(url: ENV['REDIS_URL'])
}

Sidekiq.configure_server do |config|
config.redis = ConnectionPool.new(timeout: 5, size: Sidekiq.options[:concurrency] + 5, &redis_conn)
end

Sidekiq.configure_client do |config|
config.redis = ConnectionPool.new(timeout: 5, size: Sidekiq.options[:concurrency] + 5, &redis_conn)
end
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

I read this just now. Thank you for your answer.

require 'sidekiq/web' is required in config/routes.rb
```
require 'sidekiq/web'

Rails.application.routes.draw do
mount Sidekiq::Web => '/sidekiq'

end

Was this page helpful?
0 / 5 - 0 ratings