Redis-rb - Redis::CommandError: ERR unknown command 'exists?'

Redis-rb - Redis::CommandError: ERR unknown command 'exists?'

在将 Resque 与 Redis 一起用于异步作业时,看到一些我无法解释的奇怪行为。当作业失败时,方法 report_failed_job 会抛出一个异常,说明命令“存在?”不存在。以前有其他人 运行 处理过这个问题吗?

请求 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?'>

这是堆栈跟踪:

    [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>'"

resque-retry-1.7.6 正在使用 Redis.exists? 方法 here,但这需要 redis>=4。您可以降级到 resque-retry-1.7.5 或升级到 redis>=4