Home > Back-end >  Redis-rb - Redis::CommandError: ERR unknown command 'exists?'
Redis-rb - Redis::CommandError: ERR unknown command 'exists?'

Time:02-25

Seeing some odd behavior that I can't quite explain when using Resque with Redis for async jobs. When a job fails, the method report_failed_job throws an exception stating that the command "exists?" does not exist. Has anyone else run into this issue before?

Resque 1.27.4
Redis 3.3.5

From: /app/gems/gems/resque-1.27.4/lib/resque/worker.rb @ line 287 Resque::Worker#report_failed_job:

    282: def report_failed_job(job,exception)
    283:   log_with_severity :error, "#{job.inspect} failed: #{exception.inspect}"
    284:   begin
    285:     job.fail(exception)
    286:   rescue Object => exception
 => 287:     log_with_severity :error, "Received exception when reporting failure: #{exception.inspect}"
    288:   end
    289:   begin
    290:     failed!
    291:   rescue Object => exception
    292:     log_with_severity :error, "Received exception when increasing failed jobs counter (redis issue) : #{exception.inspect}"
    293:   end
    294: end

[1] pry(#<Resque::Worker>)> exception
#<Redis::CommandError: ERR unknown command 'exists?'>

Here's the stacktrace:

    [2] pry(#<Resque::Worker>)> exception.backtrace
[
    [ 0] "/app/gems/gems/redis-3.3.5/lib/redis/client.rb:121:in `call'",
    [ 1] "/app/gems/gems/ddtrace-0.37.0/lib/ddtrace/contrib/redis/patcher.rb:46:in `block in call'",
    [ 2] "/app/gems/gems/ddtrace-0.37.0/lib/ddtrace/tracer.rb:276:in `trace'",
    [ 3] "/app/gems/gems/ddtrace-0.37.0/lib/ddtrace/contrib/redis/patcher.rb:40:in `call'",
    [ 4] "/app/gems/gems/redis-3.3.5/lib/redis.rb:2715:in `block in method_missing'",
    [ 5] "/app/gems/gems/redis-3.3.5/lib/redis.rb:58:in `block in synchronize'",
    [ 6] "/usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'",
    [ 7] "/app/gems/gems/redis-3.3.5/lib/redis.rb:58:in `synchronize'",
    [ 8] "/app/gems/gems/redis-3.3.5/lib/redis.rb:2714:in `method_missing'",
    [ 9] "/app/gems/gems/redis-namespace-1.8.1/lib/redis/namespace.rb:476:in `call_with_namespace'",
    [10] "/app/gems/gems/redis-namespace-1.8.1/lib/redis/namespace.rb:352:in `block (2 levels) in <class:Namespace>'",
    [11] "/app/gems/gems/resque-1.27.4/lib/resque/data_store.rb:59:in `method_missing'",
    [12] "/app/gems/gems/resque-retry-1.7.6/lib/resque/failure/multiple_with_retry_suppression.rb:153:in `redis_key_exists?'",
    [13] "/app/gems/gems/resque-retry-1.7.6/lib/resque/failure/multiple_with_retry_suppression.rb:146:in `retrying?'",
    [14] "/app/gems/gems/resque-retry-1.7.6/lib/resque/failure/multiple_with_retry_suppression.rb:35:in `save'",
    [15] "/app/gems/gems/resque-1.27.4/lib/resque/failure.rb:17:in `create'",
    [16] "/app/gems/gems/resque-1.27.4/lib/resque/job.rb:238:in `fail'",
    [17] "/app/gems/gems/resque-1.27.4/lib/resque/worker.rb:285:in `report_failed_job'",
    [18] "/app/gems/gems/resque-1.27.4/lib/resque/worker.rb:306:in `rescue in perform'",
    [19] "/app/gems/gems/resque-1.27.4/lib/resque/worker.rb:311:in `perform'",
    [20] "/app/gems/gems/resque-1.27.4/lib/resque/worker.rb:894:in `block in perform_with_fork'",
    [21] "/app/gems/gems/resque-1.27.4/lib/resque/worker.rb:892:in `fork'",
    [22] "/app/gems/gems/resque-1.27.4/lib/resque/worker.rb:892:in `perform_with_fork'",
    [23] "/app/gems/gems/resque-1.27.4/lib/resque/worker.rb:260:in `work_one_job'",
    [24] "/app/gems/gems/resque-1.27.4/lib/resque/worker.rb:234:in `block in work'",
    [25] "/app/gems/gems/resque-1.27.4/lib/resque/worker.rb:231:in `loop'",
    [26] "/app/gems/gems/resque-1.27.4/lib/resque/worker.rb:231:in `work'",
    [27] "/app/gems/gems/resque-1.27.4/lib/resque/tasks.rb:20:in `block (2 levels) in <top (required)>'",
    [28] "/app/gems/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'",
    [29] "/app/gems/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'",
    [30] "/app/gems/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'",
    [31] "/app/gems/gems/airbrake-10.0.6/lib/airbrake/rake.rb:19:in `execute'",
    [32] "/app/gems/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'",
    [33] "/usr/local/lib/ruby/2.4.0/monitor.rb:214:in `mon_synchronize'",
    [34] "/app/gems/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'",
    [35] "/app/gems/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'",
    [36] "/app/gems/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'",
    [37] "/app/gems/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'",
    [38] "/app/gems/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'",
    [39] "/app/gems/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'",
    [40] "/app/gems/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'",
    [41] "/app/gems/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'",
    [42] "/app/gems/gems/railties-5.0.7.2/lib/rails/commands/rake_proxy.rb:14:in `block in run_rake_task'",
    [43] "/app/gems/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'",
    [44] "/app/gems/gems/railties-5.0.7.2/lib/rails/commands/rake_proxy.rb:11:in `run_rake_task'",
    [45] "/app/gems/gems/railties-5.0.7.2/lib/rails/commands/commands_tasks.rb:51:in `run_command!'",
    [46] "/app/gems/gems/railties-5.0.7.2/lib/rails/commands.rb:18:in `<top (required)>'",
    [47] "/app/development/bin/rails:4:in `require'",
    [48] "/app/development/bin/rails:4:in `<main>'"

CodePudding user response:

resque-retry-1.7.6 is using the Redis.exists? method here, but this requires redis>=4. You can downgrade to resque-retry-1.7.5 or upgrade to redis>=4.

  • Related