sidekiq没有处理工作,应用程序范围,在jruby

时间:2015-01-19 15:04:15

标签: sidekiq jrubyonrails

我需要能够运行' jruby'与' sidekiq'一起努力为我的旧Web应用程序添加并行性能力,最初使用MRI ruby​​编写。 我现在在jruby 1.7.16.1,rails 3.2.8和mysql 5.5上运行它,就像我在同一台机器上开发的其他应用程序一样,并在“美洲豹”上托管应用程序。网络服务器。

一切似乎都运行得很好,所有UI都正常运行。 除了我真正需要实现的一件重要事情之外,sidekiq似乎并不专门为上述迁移的Web应用程序处理工作。

我相信我按照ryan batesŏ railscast ep366:http://railscasts.com/episodes/366-sidekiq正确设置了所有内容。

很奇怪,你猜怎么着,我惊讶地发现,当我在另一个小测试项目中使用相同的rails 3.2.8以及来自上面的大应用程序的相同的小宝石子集运行sidekiq时它会工作。这也在同一台机器上进行了测试(Macbook Pro / OSX 10.8)。 ,我设法启动redis-server运行,并让sidekiq自动拾取作业,在后台完美处理。

这是我每次尝试通过命令运行sidekiq时出现的错误" bundle exec sidekiq -C ./config/sidekiq.yml"

2015-01-19T14:29:51.072Z 6098 TID-43g INFO: Running in jruby 1.7.16.1 (1.9.3p392) 2014-10-28 4e93f31 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_71-b14 +jit [darwin-x86_64]
2015-01-19T14:29:51.073Z 6098 TID-43g INFO: See LICENSE and the LGPL-3.0 for licensing details.
2015-01-19T14:29:51.074Z 6098 TID-43g INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org/pro
2015-01-19T14:29:51.074Z 6098 TID-43g INFO: Starting processing, hit Ctrl-C to stop
2015-01-19T14:29:51.087Z 6098 TID-4dg ERROR: Actor crashed!
Java::JavaLang::NullPointerException:
    java.lang.Thread.setName(java/lang/Thread.java:1161)
    java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:606)
    RUBY.name_current_thread(/Users/admin/.rvm/gems/jruby-1.7.16.1@rails3.2.8/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:164)
    RUBY.initialize(/Users/admin/.rvm/gems/jruby-1.7.16.1@rails3.2.8/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:61)
    RUBY.create(/Users/admin/.rvm/gems/jruby-1.7.16.1@rails3.2.8/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15)
    java.util.concurrent.ThreadPoolExecutor.runWorker(java/util/concurrent/ThreadPoolExecutor.java:1145)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(java/util/concurrent/ThreadPoolExecutor.java:615)
    java.lang.Thread.run(java/lang/Thread.java:745)
2015-01-19T14:29:51.089Z 6098 TID-4dg ERROR: thread crashed
Java::JavaLang::NullPointerException:
    java.lang.Thread.setName(java/lang/Thread.java:1161)
    java.lang.reflect.Method.invoke(java/lang/reflect/Method.java:606)
    RUBY.name_current_thread(/Users/admin/.rvm/gems/jruby-1.7.16.1@rails3.2.8/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:164)
    RUBY.initialize(/Users/admin/.rvm/gems/jruby-1.7.16.1@rails3.2.8/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:61)
    RUBY.create(/Users/admin/.rvm/gems/jruby-1.7.16.1@rails3.2.8/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15)
    java.util.concurrent.ThreadPoolExecutor.runWorker(java/util/concurrent/ThreadPoolExecutor.java:1145)
    java.util.concurrent.ThreadPoolExecutor$Worker.run(java/util/concurrent/ThreadPoolExecutor.java:615)
    java.lang.Thread.run(java/lang/Thread.java:745)

一个听起来非常关键并且最终阻碍正在进行的过程的错误无疑是说“#34;线程崩溃"”。之后所有的sidekiq过程似乎都挂了。

在这里,我想分享我的Gemfile,以防它为你们提供更多线索:

source 'http://rubygems.org'

gem 'rails', '3.2.8'
gem 'rubyzip', '< 1.0.0'
gem 'roo','1.12.1'
gem 'jdbc-mysql', platform: :jruby
gem 'activerecord-jdbcmysql-adapter', platform: :jruby
gem 'jquery-rails', '2.1.2'

gem 'haml', '3.1.7'
gem 'puma'

gem 'devise', '2.1.2'
gem 'devise-async', '0.5.0'
gem 'cancan', '1.6.8'
gem 'simple_form', '2.0.4'
gem 'cocoon', '1.1.1'
gem 'inherited_resources', '1.3.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.9'
gem 'mechanize', '2.5.1'
gem 'delayed_job', '3.0.4'
gem 'paperclip', '3.4.0'
gem 'spreadsheet', '0.6.4.1'
gem 'geocoder', '1.1.6'
gem 'whenever', '0.8.2'
gem 'american_date', '1.0.0'
gem 'money','5.1.1'
gem 'rets','0.5.1'
gem 'haversine','0.3.0'
gem 'sidekiq','3.2.2'
gem 'sinatra'

group :assets do
  gem 'stylus', '0.7.1'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.3.0'
end

我的配置/ sidekiq.yml文件:

---
:concurrency: 2
:pidfile: tmp/pids/sidekiq.pid
:logfile: log/sidekiq.log
:verbose: true
staging:
  :concurrency: 10
production:
  :concurrency: 20
:queues:
  - default
  - [myqueue, 2]

最后一块是工人阶级本身:

工人/ pygments_worker.rb

class PygmentsWorker
  include Sidekiq::Worker

  def perform(snippet_id)
    puts "performing lengthy task #{snippet_id}"
    sleep 60
  end
end

任何想法如何让这个工作?非常感谢您的建议

0 个答案:

没有答案