Limit_req truncating responses

Hello,
I’m seeing some undocumented behavior when using limit_req and
limit_req_zone. It seems that connections that should be delayed are
actually being truncated in the middle. I see this using multiple
clients both as errors in the clients and by inspecting the actual file.
I found a reference to another user seeing this here:
http://www.ruby-forum.com/topic/173021 but I don’t see anything there to
help stop it.

I have configured my zone for now exactly as the docs:
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;

and my location as:
limit_req zone=one burst=5000;

I run a series of file transfers and it cuts off at the same truncated
file regardless if the burst is 5, 50, or 5000

I’m running .7.62 on RHEL.

Any suggestions on how to avoid the truncated files, and why the burst
level seems to not have any effect?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,9556,9556#msg-9556

Hello!

On Sun, Sep 27, 2009 at 05:59:07PM -0400, brianf wrote:

I’m running .7.62 on RHEL.

Any suggestions on how to avoid the truncated files, and why the burst level seems to not have any effect?

This was fixed in 0.8.5:

*) Bugfix: in ngx_http_limit_req_module.

This fix wasn’t yet merged into stable branch. If you have to use
stable for some reason - workaround is to use

limit_req … nodelay;

or apply relevant patch manually. It can be found here:

http://mdounin.ru/hg/nginx-vendor-current/diff/e8b686f230a8/src/http/modules/ngx_http_limit_req_module.c
http://mdounin.ru/hg/nginx-vendor-current/raw-diff/e8b686f230a8/src/http/modules/ngx_http_limit_req_module.c

Maxim D.

Applying the patch solved it, thanks a bunch.

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,9556,9630#msg-9630

Just a follow up to some more observed behavior:

It seems that if I set the burst number low enough to trigger 503’s with
my tests, the system continuously returns 503 until i restart nginx. Is
this another known bug?

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,9556,9810#msg-9810

Hello!

On Tue, Sep 29, 2009 at 12:11:02AM -0400, brianf wrote:

Just a follow up to some more observed behavior:

It seems that if I set the burst number low enough to trigger 503’s with my tests, the system continuously returns 503 until i restart nginx. Is this another known bug?

Current implementation counts requests against rate limit even if
it returns 503. So if you have

limit_req_zone  ...  rate=1r/s;
limit_req  burst=10;

and did 100 requests at a time (90 of which returned 503) - you
have to wait 100 seconds until next request will be allowed.

And yes, it’s known issue.

Maxim D.

On Tue, Sep 29, 2009 at 11:37:43AM +0400, Maxim D. wrote:

limit_req_zone  ...  rate=1r/s;
limit_req  burst=10;

and did 100 requests at a time (90 of which returned 503) - you
have to wait 100 seconds until next request will be allowed.

And yes, it’s known issue.

I’m going to fix this in 0.8.18: to implement right leaky bucket
algorithm.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs