Zbatery/Rainbows keepalive problem?
jakecdouglas at gmail.com
Sat Nov 27 16:55:34 EST 2010
On Sat, Nov 27, 2010 at 12:50 AM, Eric Wong <normalperson at yhbt.net> wrote:
> Jake Douglas <jakecdouglas at gmail.com> wrote:
>> On Wed, Nov 24, 2010 at 2:14 PM, Eric Wong <normalperson at yhbt.net> wrote:
>> > The normal Rails "render" path already seems to add Content-Length;
>> > are you doing something else to send responses from Rails?
>> I am not doing anything special to send responses from Rails, only 'render'.
>> I can see in my browser that keep-alive is set, and Content-Length is
>> also set. It looks like the first couple requests finish quickly, and
>> then the remaining take an additional 5 seconds each. It seems the
>> browser is hanging for the default keep-alive timeout of 5 seconds on
>> each request before proceeding. This happens with different browsers.
> Interesting. I rarely actually do anything with a full web browser,
> but I can confirm keepalive works as expected with curl... Is there
> anything in your error logs such as exceptions being thrown by your
> Can anybody else reproduce this behavior Jake is seeing?
>> Is there additional information I can provide to give better insight
>> into why this is happening?
> tcpdump or similar output would be useful, thanks!
> Eric Wong
> Rainbows! mailing list - rainbows-talk at rubyforge.org
> Do not quote signatures (like this one) or top post when replying
It looks like the first issue is that by default Rails does not
actually use Rack::ContentLength or set the Content-Length itself.
The next issue is this bug, where Rack::ContentLength has some
conditions that cause it to skip handling of the
ActionDispatch::Response object from Rails. (ActionDispatch::Response
Fixing and enabling Rack::ContentLength seems to fix the issue for a
single request to Rails from curl, but I am still getting the problem
in my browser(s). Zbatery logs say that the request finishes quickly
but the browser hangs for 5 seconds at a time. It is unclear to me
what the cause is. I will try to do some more research and let you
know the result.
More information about the rainbows-talk