我有一个rails项目,它使用resque worker,使用这样的Gemfile:
source 'https://rubygems.org'
gem 'rails', '3.2.5'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'rest-open-uri'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'therubyracer' # If using Ruby
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails'
gem 'less-rails-bootstrap'
gem 'devise'
gem 'net-http-digest_auth', '1.2.1'
gem "resque", :require => "resque/server"
gem 'carrierwave'
gem 'kaminari'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
执行bundle install
并尝试使用命令rake resque:work QUEUE=checker_queue
或bundle exec rake resque:work QUEUE=checker_queue
启动某些resque worker后,我的机器停止响应(对任何事情)。当我用htop
观察系统时,我看到rake创建了新的进程,直到机器的内存和交换空间都满了为止(此时机器没有响应)。
任何想法都会说明这种奇怪行为的原因吗?
Redis版本:
# redis-server -v
Redis server version 2.2.12 (00000000:0)
Ruby版本:
# ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
Gemfile.lock的:
GEM
remote: https://rubygems.org/
specs:
actionmailer (3.2.15)
actionpack (= 3.2.15)
mail (~> 2.5.4)
actionpack (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.5)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.15)
activesupport (= 3.2.15)
builder (~> 3.0.0)
activerecord (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.15)
activemodel (= 3.2.15)
activesupport (= 3.2.15)
activesupport (3.2.15)
i18n (~> 0.6, >= 0.6.4)
multi_json (~> 1.0)
arel (3.0.2)
atomic (1.1.14)
bcrypt-ruby (3.1.2)
builder (3.0.4)
carrierwave (0.9.0)
activemodel (>= 3.2.0)
activesupport (>= 3.2.0)
json (>= 1.7)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
commonjs (0.2.7)
devise (3.1.1)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
erubis (2.7.0)
execjs (2.0.2)
hike (1.2.3)
i18n (0.6.5)
journey (1.0.4)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
kaminari (0.14.1)
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
less (2.4.0)
commonjs (~> 0.2.7)
less-rails (2.4.2)
actionpack (>= 3.1)
less (~> 2.4.0)
less-rails-bootstrap (3.0.4)
less-rails (~> 2.4.2)
libv8 (3.16.14.3)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.25)
mono_logger (1.1.0)
multi_json (1.8.2)
net-http-digest_auth (1.2.1)
orm_adapter (0.4.0)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack (>= 0.4)
rack-protection (1.5.1)
rack
rack-ssl (1.3.3)
rack
rack-test (0.6.2)
rack (>= 1.0)
rails (3.2.15)
actionmailer (= 3.2.15)
actionpack (= 3.2.15)
activerecord (= 3.2.15)
activeresource (= 3.2.15)
activesupport (= 3.2.15)
bundler (~> 1.0)
railties (= 3.2.15)
railties (3.2.15)
actionpack (= 3.2.15)
activesupport (= 3.2.15)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (10.1.0)
rdoc (3.12.2)
json (~> 1.4)
redis (3.0.5)
redis-namespace (1.3.2)
redis (~> 3.0.4)
ref (1.0.5)
resque (1.25.1)
mono_logger (~> 1.0)
multi_json (~> 1.0)
redis-namespace (~> 1.2)
sinatra (>= 0.9.2)
vegas (~> 0.1.2)
rest-open-uri (1.0.0)
sass (3.2.12)
sass-rails (3.2.6)
railties (~> 3.2.0)
sass (>= 3.1.10)
tilt (~> 1.3)
sinatra (1.4.4)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.8)
therubyracer (0.12.0)
libv8 (~> 3.16.14.0)
ref
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.38)
uglifier (2.3.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
vegas (0.1.11)
rack (>= 1.0.0)
warden (1.2.3)
rack (>= 1.0)
PLATFORMS
ruby
DEPENDENCIES
carrierwave
coffee-rails (~> 3.2.1)
devise
jquery-rails
kaminari
less-rails-bootstrap
net-http-digest_auth (= 1.2.1)
rails (= 3.2.15)
resque
rest-open-uri
sass-rails (~> 3.2.3)
sqlite3
therubyracer
uglifier (>= 1.0.3)
答案 0 :(得分:1)
也许在应用程序代码中存在一个错误来安排resque作业,或者可能有很多待处理的作业,或者问题可能在于任务本身。无论如何也要尝试检查resque状态:
Resque.info
Resque.size :medium
也许它有助于识别问题