zedshaw/mongrel2 — Issue #114: ab on Mac OS X 10.7.3
Author: ngocdaothanh
Created: 2012-02-29 09:52:10+00:00
State: open

I'm using Mongrel2 1.7.5, compiled from source, on Mac OS X 10.7.3.

I created a brand new Rails 3.2.1 project and I followed this instruction:
http://verboselogging.com/2010/10/26/deploying-your-ruby-app-with-mongrel2

After starting the project and Mongrel2 as instructed, I tested with "ab" program:
ab -c 1 -n 1 http://127.0.0.1:8080/

After a few seconds, I saw a lot of errors like this in the Mongrel2 console, and Mongel2 could not process new normal requests from normal browser:
...
[ERROR] (src/register.c:214: errno: None) Nothing registered under id 2.
[ERROR] (src/register.c:199: errno: None) Invalid FD given for exists check
[ERROR] (src/register.c:214: errno: Resource temporarily unavailable) Nothing registered under id 2.
[ERROR] (src/register.c:199: errno: None) Invalid FD given for exists check
[ERROR] (src/register.c:214: errno: None) Nothing registered under id 2.
[ERROR] (src/register.c:199: errno: None) Invalid FD given for exists check
...

I'm inspecting this problem. It seems that ab on Mac does not send just 1 request. It attacks Mongrel2 by sending endless number of requests.

OK, may be this is the problem of ab. But to protect from attacks like this, I think Mongrel2 should not accept too many new requests (or send new requests to backend) if response for the old request hasn't arrived. I guess this problem is hard to solve because of the async feature of Mongrel2.