Skip to content

Instantly share code, notes, and snippets.

@chaizhenhua
Created January 9, 2014 14:49
Show Gist options
  • Select an option

  • Save chaizhenhua/8335236 to your computer and use it in GitHub Desktop.

Select an option

Save chaizhenhua/8335236 to your computer and use it in GitHub Desktop.
1. rails c > A::A.poll > A::B.poll > A::A.poll > ... 2. run sidekiq 3. open sidekiq web and enqueue all scheduled job then sidekiq crashed
# /lib/a/a.rb
module A
class A < Base
include Handler::Poller
end
end
module A
class B < Base
include Handler::Poller
end
end
module A
class Base
end
end
module Handler
module Poller
sleep 1
def self.included(base)
sleep 1
base.class_eval {
include Sidekiq::Worker
sidekiq_options queue: :default
# sidekiq_options queue: self.to_s
}
base.extend(ClassMethods)
end
module ClassMethods
def poll
perform_in 300
end
end
def perform()
self.class.poll
end
end
end
Logfile created on 2014-01-09 22:34:11 +0800 by logger.rb/36483
2014-01-09T14:34:13Z 12836 TID-8t9q8 INFO: Booting Sidekiq 2.17.2 with redis options {}
2014-01-09T14:34:13Z 12836 TID-8t9q8 INFO: Running in ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
2014-01-09T14:34:13Z 12836 TID-8t9q8 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2014-01-09T14:34:13Z 12836 TID-a1o3c DEBUG: {:queues=>["default", "default", "default", "default", "default"], :concurrency=>25, :require=>".", :environment=>nil, :timeout=>8, :profile=>false, :verbose=>true, :pidfile=>"./tmp/pids/sidekiq.pid", :logfile=>"sidekiq.log", :strict=>false, :config_file=>"config/sidekiq.yml", :daemon=>true, :tag=>"project"}
2014-01-09T14:34:28Z 12836 TID-cjnh4 WARN: {"retry"=>true, "queue"=>"default", "class"=>"A::B", "args"=>[], "jid"=>"b7ca899f7a80fe967e723799", "enqueued_at"=>1389277910.105492}
2014-01-09T14:34:28Z 12836 TID-cjnh4 WARN: undefined method `jid=' for #<A::B:0x00000003b0b780>
2014-01-09T14:34:28Z 12836 TID-cjnh4 WARN: /home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:45:in `block in process'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:86:in `do_defer'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:37:in `process'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `public_send'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `dispatch'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/calls.rb:122:in `dispatch'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/actor.rb:322:in `block in handle_message'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:in `block in task'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:55:in `block in initialize'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:13:in `block in create'
2014-01-09T14:34:28Z 12836 TID-cjnh4 ERROR: Sidekiq::Processor crashed!
NoMethodError: undefined method `jid=' for #<A::B:0x00000003b0b780>
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:45:in `block in process'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:86:in `do_defer'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:37:in `process'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `public_send'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `dispatch'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/calls.rb:122:in `dispatch'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/actor.rb:322:in `block in handle_message'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:in `block in task'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:55:in `block in initialize'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:13:in `block in create'
2014-01-09T14:34:28Z 12836 TID-g43xo WARN: {"retry"=>true, "queue"=>"default", "class"=>"A::B", "args"=>[], "jid"=>"f5deb38e256a193ad1250c94", "enqueued_at"=>1389277988.3112736}
2014-01-09T14:34:28Z 12836 TID-g43xo WARN: undefined method `jid=' for #<A::B:0x00000003b45958>
2014-01-09T14:34:28Z 12836 TID-g43xo WARN: /home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:45:in `block in process'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:86:in `do_defer'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-2.17.2/lib/sidekiq/processor.rb:37:in `process'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `public_send'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `dispatch'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/calls.rb:122:in `dispatch'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/actor.rb:322:in `block in handle_message'
/home/chaizhenhua/.rvm/gems/ruby-2.0.0-p247/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:in `block in task'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment