unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
* http_response seems to be using String.each
@ 2011-09-21 23:42 Joe Marty
  2011-09-22  0:46 ` Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Joe Marty @ 2011-09-21 23:42 UTC (permalink / raw)
  To: mongrel-unicorn

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 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 rails app does work fine in Passenger, and if I just swap out
passenger for Unicorn, it fails with that message.

-Joe
_______________________________________________
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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: http_response seems to be using String.each
  2011-09-21 23:42 http_response seems to be using String.each Joe Marty
@ 2011-09-22  0:46 ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2011-09-22  0:46 UTC (permalink / raw)
  To: unicorn list

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-22  1:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-21 23:42 http_response seems to be using String.each Joe Marty
2011-09-22  0:46 ` Eric Wong

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).