Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception ERR unknown command 'exists?' in 3.1.0 #345

Closed
barrucadu opened this issue Jul 16, 2021 · 11 comments · Fixed by #370
Closed

Exception ERR unknown command 'exists?' in 3.1.0 #345

barrucadu opened this issue Jul 16, 2021 · 11 comments · Fixed by #370
Milestone

Comments

@barrucadu
Copy link

barrucadu commented Jul 16, 2021

Hello, I think the change introduced in #335 isn't quite right, as in my app the r.exists? case is always getting called, even though it's not supported by redis gem I'm using:

irb(main):002:0> Sidekiq.redis { |r| r.exists?(:schedules) }
Traceback (most recent call last):
        3: from (irb):1
        2: from (irb):2:in `rescue in irb_binding'
        1: from (irb):2:in `block in irb_binding'
Redis::CommandError (ERR unknown command 'exists?')

irb(main):003:0> Sidekiq.redis { |r| !!r.exists(:schedules) }
=> false

irb(main):004:0> Sidekiq.redis { |r| r.respond_to?(:exists?) }
=> true

This is making the worker crash on start-up:

ERR unknown command 'exists?'     
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/redis-4.1.4/lib/redis/client.rb:126:in `call'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/redis-4.1.4/lib/redis.rb:3312:in `block in method_missing'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/redis-4.1.4/lib/redis.rb:51:in `block in synchronize'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/monitor.rb:202:in `synchronize'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/monitor.rb:202:in `mon_synchronize'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/redis-4.1.4/lib/redis.rb:51:in `synchronize'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/redis-4.1.4/lib/redis.rb:3311:in `method_missing'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/redis-namespace-1.8.1/lib/redis/namespace.rb:476:in `call_with_namespace'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/redis-namespace-1.8.1/lib/redis/namespace.rb:352:in `block (2 levels) in <class:Namespace>'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-scheduler-3.1.0/lib/sidekiq-scheduler/redis_manager.rb:101:in `block in schedule_exist?'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-5.2.9/lib/sidekiq.rb:97:in `block in redis'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/connection_pool-2.2.5/lib/connection_pool.rb:63:in `block (2 levels) in with'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/connection_pool-2.2.5/lib/connection_pool.rb:62:in `handle_interrupt'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/connection_pool-2.2.5/lib/connection_pool.rb:62:in `block in with'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/connection_pool-2.2.5/lib/connection_pool.rb:59:in `handle_interrupt'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/connection_pool-2.2.5/lib/connection_pool.rb:59:in `with'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-5.2.9/lib/sidekiq.rb:94:in `redis'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-scheduler-3.1.0/lib/sidekiq-scheduler/redis_manager.rb:99:in `schedule_exist?'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-scheduler-3.1.0/lib/sidekiq-scheduler/schedule.rb:84:in `get_all_schedules'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-scheduler-3.1.0/lib/sidekiq-scheduler/schedule.rb:43:in `schedule='
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-scheduler-3.1.0/lib/sidekiq-scheduler/manager.rb:29:in `initialize'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-scheduler-3.1.0/lib/sidekiq-scheduler.rb:16:in `new'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-scheduler-3.1.0/lib/sidekiq-scheduler.rb:16:in `block (2 levels) in <main>'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-5.2.9/lib/sidekiq/util.rb:57:in `block in fire_event'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-5.2.9/lib/sidekiq/util.rb:55:in `each'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-5.2.9/lib/sidekiq/util.rb:55:in `fire_event'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-5.2.9/lib/sidekiq/cli.rb:91:in `run'
/data/vhost/account-api/shared/bundle/ruby/2.7.0/gems/sidekiq-5.2.9/bin/sidekiq:12:in `<top (required)>'
/data/apps/account-api/shared/bundle/ruby/2.7.0/bin/sidekiq:23:in `load'
/data/apps/account-api/shared/bundle/ruby/2.7.0/bin/sidekiq:23:in `<top (required)>'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `load'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:63:in `kernel_load'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/cli/exec.rb:28:in `run'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/cli.rb:476:in `exec'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor.rb:399:in `dispatch'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/cli.rb:30:in `dispatch'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/vendor/thor/lib/thor/base.rb:476:in `start'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/cli.rb:24:in `start'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:46:in `block in <top (required)>'
/usr/lib/rbenv/versions/2.7.2/lib/ruby/2.7.0/bundler/friendly_errors.rb:123:in `with_friendly_errors' 
/usr/lib/rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bundler-2.1.4/libexec/bundle:34:in `<top (required)>'
/usr/lib/rbenv/versions/2.7.2/bin/bundle:23:in `load'
/usr/lib/rbenv/versions/2.7.2/bin/bundle:23:in `<main>'

This could be an issue in sidekiq or the redis gem but, since it's surfacing in this gem, I'm reporting it here.

For now I'll downgrade the gem to version 3.0.1.

barrucadu added a commit to alphagov/account-api that referenced this issue Jul 16, 2021
In 3.1.0 it tries to use `exists?` instead of `exists`, but `exists?`
does not exist:

sidekiq-scheduler/sidekiq-scheduler#345
@marcelolx
Copy link
Member

@barrucadu I'll take a look tonight

@marcelolx
Copy link
Member

marcelolx commented Jul 16, 2021

Which version of redis are you using? Ok, I see and it looks like that it's 4.1.4

@marcelolx
Copy link
Member

@barrucadu The problem happens because your project alphagov/account-api depends on govuk_sidekiq which depends on redis-namespace and redis-namespace has added support for exists? on 1.8 https://github.com/resque/redis-namespace/blob/f95dcb968b4b2ef41d604cbdc2e22a1f79ae23e6/CHANGELOG.md#180 and because of that respond_to?(:exists?) always returns true even when the redis gem doesn't responds to this method since your project is already using 1.8.1 https://github.com/alphagov/account-api/blob/main/Gemfile.lock#L342 ¯_(ツ)_/¯

I'll be able to fix this on sidekiq-scheduler side, but that will require a major bump since we have to upgrade some dependecies and with that also drop support for ruby 2.2, 2.3 and 2.4 because those dependencies droped support for this ruby versions. (ruby 2.4 already reached EOL so I think that's not a problem)

I'll revert #335 which means the warning will come back to 3.x and will only be resolved on 4.0

@stale
Copy link

stale bot commented Oct 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale The issue or PR has been inactive label Oct 2, 2021
@marcelolx marcelolx removed the stale The issue or PR has been inactive label Oct 2, 2021
@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the stale The issue or PR has been inactive label Jan 9, 2022
@marcelolx marcelolx removed the stale The issue or PR has been inactive label Jan 9, 2022
@marcelolx marcelolx added this to the v4 milestone Mar 8, 2022
@marcelolx
Copy link
Member

@barrucadu I've merged #370, can you test on your end with the master branch if it solves the problem on your end?

@ustincameron
Copy link

ustincameron commented Dec 29, 2022

Using Ruby 3.1.2, Sidekiq 7.0.2, Redis 7.0.5 and Sidekiq-scheduler 5.0.0.beta1, but running into this same error when trying to view the /recurring-jobs page.

Any suggestions?

@t27duck
Copy link
Contributor

t27duck commented Dec 29, 2022

@ustincameron According to the Sidekiq readme (which is tracking sidekiq 7), Sidekiq 7.x requires Redis 6.2 or later.

https://github.com/mperham/sidekiq#requirements

@ustincameron
Copy link

@t27duck My apologies for the typo, currently running Redis 7.0.5.

The schedule is being loaded and the logs are showing the jobs are firing appropriately, but unable to see the recurring jobs via the web view.

@t27duck
Copy link
Contributor

t27duck commented Dec 29, 2022

Hmmm... something seems off then. The app I have (where the reoccurring jobs tab works fine) has the exact same versions as you listed... minus Ruby which is 3.1.3.

@marcelolx
Copy link
Member

@ustincameron can you provide a stack trace? And if possible, a sample app?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants