skip to Main Content

I just ran a docker-compose build on my latest docker container and I noticed that sidekiq is now generating this line, repetitively:

sidekiq_1   | `Redis#exists(key)` will return an Integer in redis-rb 4.3. `exists?` returns a boolean, you should use it instead. To opt-in to the new behavior now you can set Redis.exists_returns_integer =  true. To disable this message and keep the current (boolean) behaviour of 'exists' you can set `Redis.exists_returns_integer = false`, but this option will be removed in 5.0. (/usr/local/bundle/gems/sidekiq-6.0.7/lib/sidekiq/launcher.rb:160:in `block (2 levels) in ❤')

Where exactly do I set this setting? I tried to create an initializer, but I’m sure I’m doing this wrong:

# config/initializers/sidekiq.rb
redis_conn = proc {
  Redis.exists_returns_integer =  true
}

Sidekiq.configure_client do |config|
  config.redis = ConnectionPool.new(size: 5, &redis_conn)
end

Sidekiq.configure_server do |config|
  config.redis = ConnectionPool.new(size: 25, &redis_conn)
end

The container failed with this error when trying to use the code from the initializer above:

sidekiq_1   | 2020-06-17T02:42:21.743Z pid=1 tid=gshym9ynx INFO: Booted Rails 5.2.4 application in development environment
sidekiq_1   | 2020-06-17T02:42:21.743Z pid=1 tid=gshym9ynx INFO: Running in ruby 2.5.8p224 (2020-03-31 revision 67882) [x86_64-linux]
sidekiq_1   | 2020-06-17T02:42:21.743Z pid=1 tid=gshym9ynx INFO: See LICENSE and the LGPL-3.0 for licensing details.
sidekiq_1   | 2020-06-17T02:42:21.743Z pid=1 tid=gshym9ynx INFO: Upgrade to Sidekiq Pro for more features and support: https://sidekiq.org
sidekiq_1   | undefined method `info' for true:TrueClass
sidekiq_1   | /usr/local/bundle/gems/sidekiq-6.0.7/lib/sidekiq.rb:118:in `block in redis_info'
sidekiq_1   | /usr/local/bundle/gems/sidekiq-6.0.7/lib/sidekiq.rb:97:in `block in redis'
sidekiq_1   | /usr/local/bundle/gems/connection_pool-2.2.3/lib/connection_pool.rb:63:in `block (2 levels) in with'
sidekiq_1   | /usr/local/bundle/gems/connection_pool-2.2.3/lib/connection_pool.rb:62:in `handle_interrupt'
sidekiq_1   | /usr/local/bundle/gems/connection_pool-2.2.3/lib/connection_pool.rb:62:in `block in with'
sidekiq_1   | /usr/local/bundle/gems/connection_pool-2.2.3/lib/connection_pool.rb:59:in `handle_interrupt'
sidekiq_1   | /usr/local/bundle/gems/connection_pool-2.2.3/lib/connection_pool.rb:59:in `with'
sidekiq_1   | /usr/local/bundle/gems/sidekiq-6.0.7/lib/sidekiq.rb:94:in `redis'
sidekiq_1   | /usr/local/bundle/gems/sidekiq-6.0.7/lib/sidekiq.rb:112:in `redis_info'
sidekiq_1   | /usr/local/bundle/gems/sidekiq-6.0.7/lib/sidekiq/cli.rb:61:in `run'
sidekiq_1   | /usr/local/bundle/gems/sidekiq-6.0.7/bin/sidekiq:31:in `<top (required)>'
sidekiq_1   | /usr/local/bundle/bin/sidekiq:23:in `load'
sidekiq_1   | /usr/local/bundle/bin/sidekiq:23:in `<top (required)>'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `load'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:74:in `kernel_load'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli/exec.rb:28:in `run'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:463:in `exec'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:27:in `dispatch'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/cli.rb:18:in `start'
sidekiq_1   | /usr/local/bin/bundle:30:in `block in <main>'
sidekiq_1   | /usr/local/lib/ruby/site_ruby/2.5.0/bundler/friendly_errors.rb:124:in `with_friendly_errors'
sidekiq_1   | /usr/local/bin/bundle:22:in `<main>'
test_sidekiq_1 exited with code 1

2

Answers


  1. There is an issue on the sidekiq github related to this issue.

    You can see it here: https://github.com/mperham/sidekiq/issues/4591

    Basically, the redis gem made a change that, going forward, will cause different behavior when using a certain method. There’s nothing you can do to suppress this message until Sidekiq 6.1 comes out other than temporarily downgrade the version of the redis gem you’re using.

    I currently have this in my Gemfile to avoid getting spammed with this message.

    gem 'redis', '4.1.4'
    

    The problem isn’t anything you’re doing, it’s the libraries you’re using.

    Login or Signup to reply.
  2. Just add an initializer file redis.rb to silence the warning.

    if Gem::Version.new(Sidekiq::VERSION) < Gem::Version.new('6.1')
      Redis.exists_returns_integer = true
    else
      raise 'Time to remove Redis.exists_returns_integer: https://github.com/mperham/sidekiq/issues/4591'
    end
    

    credits: https://github.com/DFE-Digital/apply-for-postgraduate-teacher-training/pull/2275/files/16d2ad7ae053247760cf3905cdbacfdf4ec4b7ea

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search