unicorn-worker-killer icon indicating copy to clipboard operation
unicorn-worker-killer copied to clipboard

Error in unicorn/worker_killer.rb:52:in `process_client'

Open ckbhodge opened this issue 9 years ago • 3 comments

I'm running ruby 2.1.2 and rails 3.2.22. I'm getting this error in my logs right after I tried to add unicorn-worker-killer:

_dispatch/middleware/debug_exceptions.rb:16:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/rollbar-1.5.1/lib/rollbar/middleware/rails/show_exceptions.rb:22:in `call_with_rollbar'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.22/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/railties-3.2.22/lib/rails/rack/logger.rb:32:in `call_app'", "/app/vendor/bundle/ruby/2.1.0/gems/railties-3.2.22/lib/rails/rack/logger.rb:16:in `block in call'", "/app/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/tagged_logging.rb:22:in `tagged'", "/app/vendor/bundle/ruby/2.1.0/gems/railties-3.2.22/lib/rails/rack/logger.rb:16:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.22/lib/action_dispatch/middleware/request_id.rb:22:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/rack-1.4.7/lib/rack/methodoverride.rb:21:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/rack-1.4.7/lib/rack/runtime.rb:17:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.22/lib/active_support/cache/strategy/local_cache.rb:72:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/rack-1.4.7/lib/rack/lock.rb:15:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/actionpack-3.2.22/lib/action_dispatch/middleware/static.rb:83:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'", "/app/vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'", "/app/vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'", "/app/vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'", "/app/vendor/bundle/ruby/2.1.0/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/rack-timeout-0.0.4/lib/rack/timeout.rb:16:in `block in call'", "/app/vendor/ruby-2.1.2/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'", "/app/vendor/ruby-2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `call'", "/app/vendor/ruby-2.1.2/lib/ruby/2.1.0/timeout.rb:101:in `timeout'", "/app/vendor/bundle/ruby/2.1.0/gems/rack-timeout-0.0.4/lib/rack/timeout.rb:16:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/railties-3.2.22/lib/rails/engine.rb:484:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/railties-3.2.22/lib/rails/application.rb:231:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/railties-3.2.22/lib/rails/railtie/configurable.rb:30:in `method_missing'", "/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.1.236/lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in `call'", "/app/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:576:in `process_client'", "/app/vendor/bundle/ruby/2.1.0/gems/unicorn-worker-killer-0.4.3/lib/unicorn/worker_killer.rb:52:in `process_client'", "/app/vendor/bundle/ruby/2.1.0/gems/unicorn-worker-killer-0.4.3/lib/unicorn/worker_killer.rb:92:in `process_client'", "/app/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:670:in `worker_loop'", "/app/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:525:in `spawn_missing_workers'", "/app/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/lib/unicorn/http_server.rb:140:in `start'", "/app/vendor/bundle/ruby/2.1.0/gems/unicorn-4.8.3/bin/unicorn:126:in `<top (required)>'", "/app/vendor/bundle/ruby/2.1.0/bin/unicorn:23:in `load'", "/app/vendor/bundle/ruby/2.1.0/bin/unicorn:23:in `<main>'"

Here's my config.ru file:

#NOTE: Set these variables in heroku:
# heroku config:set MAX_REQUEST_MIN=3072 MAX_REQUEST_MAX=4096 OOM_MIN=192 OOM_MAX=256
if ENV['RAILS_ENV'] == 'production' && defined?(Unicorn)
  require 'unicorn'
  require 'unicorn/worker_killer'
  max_request_min =  ENV['MAX_REQUEST_MIN'].to_i || 3072
  max_request_max =  ENV['MAX_REQUEST_MAX'].to_i || 4096

  # Max requests per worker
  use Unicorn::WorkerKiller::MaxRequests, max_request_min, max_request_max

  oom_min = ((ENV['OOM_MIN'].to_i || 192) * (1024**2))
  oom_max = ((ENV['OOM_MAX'].to_i || 256) * (1024**2))

  # Max memory size (RSS) per worker
  use Unicorn::WorkerKiller::Oom, oom_min, oom_max
end

# This file is used by Rack-based servers to start the application.
require 'sidekiq/web'

require ::File.expand_path('../config/environment',  __FILE__)
run BangWithFriends::Application

ckbhodge avatar Jun 24 '15 23:06 ckbhodge

Same problem here. @ckbhodge How did you manage to pass ENV VARS to your config.ru worker_killer config?

Here's errors log:

ERROR -- : listen loop error: undefined method `-' for #<String:0x007fe1dc4ea0f0> (NoMethodError)
ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-worker-killer-0.4.4/lib/unicorn/worker_killer.rb:56:in `process_client'
ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-worker-killer-0.4.4/lib/unicorn/worker_killer.rb:92:in `process_client'
ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:658:in `worker_loop'
ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:508:in `spawn_missing_workers'
ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:132:in `start'
ERROR -- : /app/vendor/bundle/ruby/2.2.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
ERROR -- : /app/vendor/bundle/ruby/2.2.0/bin/unicorn:23:in `load'
ERROR -- : /app/vendor/bundle/ruby/2.2.0/bin/unicorn:23:in `<main>'

fro avatar May 06 '16 11:05 fro

I ended up not using unicorn-worker-killer. :/

ckbhodge avatar May 06 '16 16:05 ckbhodge

Oh. I don't get it... ENV VARS are available in config.ru, so.. is it because of the String type?

fro avatar May 06 '16 17:05 fro