5

私はsidekiq (2.13.1)(ここの依存関係を参照)、(ここの依存関係を参照) 、 (ここの依存関係を参照)を使用していますwebsocket-rails (0.6.2)redis-semaphore (0.2.1)

sidekiqアプリケーションで長い間実行されていましたが、インストール後websocket-rails、sidekiq ジョブを実行できなくなりました。それらはすべて、次のスタック トレースでクラッシュします。

2013-09-15T13:15:17Z 12682 TID-ouvinq47w INFO: Sidetiq::Clock start
2013-09-15T13:15:19Z 12682 TID-ouvinq47w INFO: Booting Sidekiq 2.13.1 using redis://localhost:6379/0 with options {}
2013-09-15T13:15:19Z 12682 TID-ouvinq47w INFO: Running in ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
2013-09-15T13:15:19Z 12682 TID-ouvinq47w INFO: See LICENSE and the LGPL-3.0 for licensing details.
2013-09-15T13:15:19Z 12682 TID-ouvinq47w INFO: Starting processing, hit Ctrl-C to stop
2013-09-15T13:15:20Z 12682 TID-ouvjitprc EvaluationsJob JID-7a108bea6da948aee5f43a99 INFO: start
2013-09-15T13:15:20Z 12682 TID-ouvjitprc EvaluationsJob JID-7a108bea6da948aee5f43a99 INFO: fail: 0.003 sec
2013-09-15T13:15:20Z 12682 TID-ouvjitprc WARN: {"retry"=>false, "queue"=>"default", "class"=>"EvaluationsJob", "args"=>["518f599683c336fb87000003"], "jid"=>"7a108bea6da948aee5f43a99", "enqueued_at"=>1379250920.38564}
2013-09-15T13:15:20Z 12682 TID-ouvjitprc WARN: eventmachine not initialized: evma_connect_to_server
2013-09-15T13:15:20Z 12682 TID-ouvjitprc WARN: /Users/john/.rvm/gems/ruby-2.0.0-p247/gems/eventmachine-1.0.3/lib/eventmachine.rb:664:in `connect_server'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/eventmachine-1.0.3/lib/eventmachine.rb:664:in `bind_connect'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/eventmachine-1.0.3/lib/eventmachine.rb:640:in `connect'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis/connection/synchrony.rb:72:in `connect'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis/client.rb:271:in `establish_connection'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis/client.rb:69:in `connect'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis/client.rb:290:in `ensure_connected'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis/client.rb:177:in `block in process'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis/client.rb:256:in `logging'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis/client.rb:176:in `process'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis/client.rb:84:in `call'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis.rb:870:in `block in getset'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis.rb:36:in `block in synchronize'
/Users/john/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis.rb:36:in `synchronize'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-3.0.4/lib/redis.rb:869:in `getset'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-semaphore-0.2.1/lib/redis/semaphore.rb:26:in `exists_or_create!'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/redis-semaphore-0.2.1/lib/redis/semaphore.rb:48:in `lock'
/Users/john/my_app/app/jobs/evaluations_job.rb:9:in `perform'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/processor.rb:48:in `block (3 levels) in process'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/chain.rb:115:in `call'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/chain.rb:115:in `block in invoke'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-failures-0.2.1/lib/sidekiq/failures/middleware.rb:10:in `call'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/chain.rb:117:in `block in invoke'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidetiq-0.3.6/lib/sidetiq/middleware.rb:13:in `call'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/chain.rb:117:in `block in invoke'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/chain.rb:117:in `block in invoke'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/server/retry_jobs.rb:62:in `call'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/chain.rb:117:in `block in invoke'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/logging.rb:22:in `with_context'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/chain.rb:117:in `block in invoke'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/chain.rb:120:in `call'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/middleware/chain.rb:120:in `invoke'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/processor.rb:47:in `block (2 levels) in process'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/processor.rb:102:in `stats'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/processor.rb:46:in `block in process'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/processor.rb:83:in `do_defer'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.13.1/lib/sidekiq/processor.rb:37:in `process'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in `public_send'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.14.1/lib/celluloid/calls.rb:25:in `dispatch'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.14.1/lib/celluloid/calls.rb:125:in `dispatch'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.14.1/lib/celluloid/actor.rb:326:in `block in handle_message'
/Users/john/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.14.1/lib/celluloid/tasks.rb:42:in `block in initialize'

私の問題はこの Github の問題に関連していますが、私のバージョンはであり、この問題に対処することになっていたバージョンwebsocket-rails (0.6.2)よりも高くなっています。websocket-rails (0.2.1)

スタック トレースは、ここで私の sidekiq ジョブを参照しています。

## jobs/evaluations_job.rb

class EvaluationsJob
  include Sidekiq::Worker
  sidekiq_options :retry => false

  def perform(user_id)
    s = Redis::Semaphore.new("perform_evaluations_for_#{user_id}".to_sym, redis: NonBlockingRedis.new(connection: "localhost"))

    if s.lock(-1)  # => THIS IS evaluations_job.rb:9 WHERE IT ALL BREAKS...
      ...
    end
  end
end

sidekiqと の両方に標準設定を使用していますwebsocket-railsが、この問題の原因がよくわからないため、このsidetiq構成ファイルを質問に含めました (開始されたジョブを使用してsidetiq他のすべてのジョブを開始しています)。

## config/initializers/sidetiq.rb

Sidekiq.configure_server do |config|
  require 'non_blocking_redis'
  Sidetiq::Clock.start!
end
4

1 に答える 1

5

これがあなたの問題を解決するための解決策になると思います

https://github.com/websocket-rails/websocket-rails/issues/29

$redis = Redis.new(:host => host, :port => port, :driver => :hiredis)
于 2013-12-18T06:58:22.077 に答える