Surendra Singhi <singhi.surendra at gmail.com>
wrote:> Hi,
>
> For one of our apps we switched to unicorn from mongrel.
> The unicorn server use to run behind an apache with timeout of 300sec,
> as sometime the customer may do a large file upload.
>
> After we made the switch we started getting lots of
> Unicorn::ClientShutdown occurred in photos#flash_upload
> bytes_read=2762663 (pr some other number)
> We were not able to recreate it in our tests, but support was getting
> customer emails, that the files upload is not working.
> It finally forced us to switch back to mongrel.
Hi Surendra,
Could you be hitting a timeout in your Apache config? Can you try
simulating a slow connection to reproduce it? Apache defaults to 300s,
too, so double check your config and make sure it''s not different
anymore. The other thing could be your kernel listen queue used by
Unicorn is completely full and Apache is just giving up on certain
requests...
> I know a fully buffering reverse proxy like nginx is advised as
> reverse proxy for unicorn, but apache has been serving us well, and we
> don''t want to change it.
> Any idea what can be going wrong, or why was unicorn throwing these errors?
While it''s generally bad for Unicorn to run behind anything other than
nginx, "generally bad" does not apply to the case of file uploads.
Honestly, when dealing with file uploads from slow clients,
Unicorn is the WORST SERVER YOU COULD EVER PICK. EVER :)
Really, trust me on this one :)
Use nginx, but if you insist on using Apache, then you''re far better
off
sticking with Mongrel or trying out Rainbows![1] for uploads.
Rainbows! has the advantage of using Unicorn''s prefork and shared
listeners along with your choice of threads/fibers/events/fibers/actors.
[1] - http://rainbows.rubyforge.org/
--
Eric Wong