unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: http_response seems to be using String.each
Date: Wed, 21 Sep 2011 17:46:13 -0700	[thread overview]
Message-ID: <20110922004613.GA16936@dcvr.yhbt.net> (raw)
In-Reply-To: <CACskX6Uuq3u_4qL5Fm5e3KXdLW28hNKPQSHrWcC8exa9wdj-hw@mail.gmail.com>

Joe Marty <joe@ownlocal.com> wrote:
> I just installed Unicorn 4.1.1 to serve a Rails 3 project behind nginx
> on a server running Ruby 1.9.2 and I'm getting this error on every app
> request:
> 
> app error: undefined method `each' for #<String:0xc42712c> (NoMethodError)
> /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.1.1/lib/unicorn/http_response.rb:41:in
> `http_response_write'

I suspect you have some buggy middleware that's returning Strings
as the body (instead of Strings inside Arrays or something else)

What middlewares do you have loaded?

You can insert Rack::Lint in between every middleware to detect buggy
ones.  If Rack::Lint slows you down too much, you can also try just
removing them one-at-a-time to isolate the buggy one.

> I don't know for sure if 'body' is supposed to be an array, or if it's
> correctly a string and Unicorn is actually trying to read the string 1
> line at a time using the each method, which was changed in ruby 1.9 to
> 'String.each_line'.  Any ideas?

The Rack spec only requires the response body respond to the "each"
method and that yields String (or String-like) objects.

> The rails app does work fine in Passenger, and if I just swap out
> passenger for Unicorn, it fails with that message.

Maybe Passenger is more lenient with the Rack specs and/or working
around bugs.

-- 
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

      reply	other threads:[~2011-09-22  1:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-21 23:42 http_response seems to be using String.each Joe Marty
2011-09-22  0:46 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110922004613.GA16936@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).