Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Unicorn and Rack-mini-profiler


  • Please log in to reply
No replies to this topic

#1 Ohm

Ohm

    Guard

  • Members
  • 179 posts
  • LocationCopenhagen

Posted 26 August 2013 - 12:12 PM

I am trying to setup unicorn for my Ruby 2.0 / Rails 3.2.14 app, however, when I run any page, the rack-mini-profiler gem gets in the way of unicorn, with the following error:

Rack::Lint::LintError: No Content-Type header found
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/lint.rb:19:in `assert'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/lint.rb:476:in `check_content_type'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/lint.rb:54:in `_call'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/lint.rb:36:in `call'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/showexceptions.rb:24:in `call'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/commonlogger.rb:33:in `call'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/chunked.rb:43:in `call'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/rack-1.4.5/lib/rack/content_length.rb:14:in `call'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:552:in `process_client'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:632:in `worker_loop'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/newrelic_rpm-3.6.6.147/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:in `call'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/newrelic_rpm-3.6.6.147/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:22:in `block (4 levels) in <top (required)>'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/lib/unicorn/http_server.rb:142:in `start'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/gems/unicorn-4.6.3/bin/unicorn:126:in `<top (required)>'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/bin/unicorn:23:in `load'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/bin/unicorn:23:in `<main>'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `eval'
	/Users/ohm/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in `<main>'
127.0.0.1 - - [26/Aug/2013 14:07:46] "POST /mini-profiler-resources/results HTTP/1.1" 500 1890 0.0022

I am running the server with

# Procfile
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb

with the following config

worker_processes 2 # amount of unicorn workers to spin up
timeout 33         # restarts workers that hang for 33 seconds
preload_app true

before_fork do |server, worker|
  Signal.trap 'TERM' do
    puts 'Unicorn master intercepting TERM and sending myself QUIT instead'
    Process.kill 'QUIT', Process.pid
  end

  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.connection.disconnect!
end

after_fork do |server, worker|
  Signal.trap 'TERM' do
    puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT'
  end

  defined?(ActiveRecord::Base) and
    ActiveRecord::Base.establish_connection
end

What am I doing wrong here?


Blog: http://ohm.sh | Twitter: madsohm





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users