On Fri, Aug 12, 2011 at 11:09 AM, Joe Van Dyk <[email protected]> wrote: > On Thu, Aug 11, 2011 at 10:42 PM, Eric Wong <[email protected]> wrote: >> Joe Van Dyk <[email protected]> wrote: >>> Has anyone seen anything like this before? I can get it to happen all >>> the time if I issue a HEAD request, but it only happens very >>> intermittently on GET requests. >>> >>> I'm using Ruby 1.9.2p180. >>> >>> Any ideas on where to start debugging? >> >> What web framework and other middlewares are you running? Are you using >> Rack::Head to >> generate HEAD responses or something else? > > Rails 3.0. I'm not doing anything special with HEAD requests. I > actually don't care about the HEAD requests -- you'll note that I'm > doing a GET request below. The Content-Length is 37902 (which is > should be), but apparently there's nothing in the response body?
Here's another example, the body is apparently empty, but the content-length is set on a 302 request. Unfortunately, I can't reproduce the problem consistently. :( I'd expect the body to not be 0 here. 216.14.95.14, 10.195.114.81 - - [12/Aug/2011 12:00:46] "GET /deals/current/good_till_gone HTTP/1.0" 302 195 0.0148 app error: Content-Length header was 195, but should be 0 (Rack::Lint::LintError) /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/rack-1.2.3/lib/rack/lint.rb:19:in `assert' /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/rack-1.2.3/lib/rack/lint.rb:501:in `verify_content_length' /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/rack-1.2.3/lib/rack/lint.rb:525:in `each' /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_response.rb:41:in `http_response_write' /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:526:in `process_client' /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:585:in `worker_loop' /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/newrelic_rpm-3.0.1/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:12:in `call' /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/newrelic_rpm-3.0.1/lib/new_relic/agent/instrumentation/unicorn_instrumentation.rb:12:in `block (4 levels) in <top (required)>' /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:475:in `spawn_missing_workers' /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:135:in `start' /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/unicorn-4.0.1/bin/unicorn:121:in `<top (required)>' /data/tanga/current/sites/tanga/bin/unicorn:16:in `load' /data/tanga/current/sites/tanga/bin/unicorn:16:in `<main>' > >>> 204.93.223.151, 10.195.114.81 - - [11/Aug/2011 21:03:50] "GET / >>> HTTP/1.0" 200 37902 0.5316 >>> app error: Content-Length header was 37902, but should be 0 >>> (Rack::Lint::LintError) >>> /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/rack-1.2.3/lib/rack/lint.rb:19:in >>> `assert' >>> /mnt/data/tanga/current/bundler/ruby/1.9.1/gems/rack-1.2.3/lib/rack/lint.rb:501:in >>> `verify_content_length' >> >> Looking at the 1.2.3 rack/lint.rb code, it should've set @head_request to >> true >> when env["REQUEST_METHOD"] == "HEAD" (rack/lint.rb line 56). >> Do you happen to have any middlewares that might rewrite REQUEST_METHOD? >> >> I would edit rack/lint.rb and put some print statements to show the >> value of @head_request and env["REQUEST_METHOD"] >> >> -- >> Eric Wong >> _______________________________________________ >> Unicorn mailing list - [email protected] >> http://rubyforge.org/mailman/listinfo/mongrel-unicorn >> Do not quote signatures (like this one) or top post when replying >> > _______________________________________________ Unicorn mailing list - [email protected] http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
