Logging errors from Unicorn
peter.kieltyka at nulayer.com
Fri Jun 4 15:06:17 EDT 2010
I'm running a Rails 3 beta3 application using Ruby 1.9.2-preview3 and it has been running fairly well, however every now and then (usually when under high load), I see error messages like:
2010/06/04 14:34:29 [error] 1884#0: *8844 upstream prematurely closed connection while reading response header from upstream, client: 188.8.131.52, server: portal.crowdreel.com, request: "GET /post/18Vmy HTTP/1.1", upstream: "http://unix:/home/app/crowdreel-portal/tmp/sockets/unicorn.sock:/post/18Vmy", host: "crowdreel.com"
... a lot of these messages.. this is a pretty heavy duty server with lots of ram.
I have a setup similar to what I read up on github's blog as in: nginx -> unicorns via a socket upstream.
My unicorn.rb file looks like:
# 16 workers and 1 master
# Load the app into the master before forking workers for super-fast worker spawn times
# Restart any workers that haven't responded in 30 seconds
# Listen on a Unix data socket
listen File.expand_path(File.dirname(__FILE__)+'/../tmp/sockets/unicorn.sock'), :backlog => 2048
I don't preload the app because I start running into annoying issues where my workers use the same db connection, so instead I just have them load their own instance, its very fast to start up anyways.
I've read everything I could on this issue and exhausted Google, which leaves me to think the only thing left is some incompatibilities with 1.9.2. So I was wondering, how can I get logs from unicorn's workers/master to know what is happening to these workers, perhaps something is segfaulting?
More information about the mongrel-unicorn