<div>Hi,</div><div><br></div><div>Yesterday error messages similar to this started filling up the logs :</div><div><br></div><div>Mar 25 01:58:22 192.168.1.136 [nginx_error] 3m2: 2011/03/25 01:58:21 [crit] 26278#0: ngx_slab_alloc() failed: no memory in limit_zone &quot;limit_inbound&quot;</div>

<div><br></div><div>And more importantly nginx started returning &quot;503 Service Temporary Unavalaible&quot; for every requests</div><div><br></div><div>The solution was simple, as to increase the memory assigned to the limit_zone rbtree.</div>

<div><br></div><div>I was thinking instead of returning NGX_HTTP_SERVICE_UNAVAILABLE when the allocation fails, maybe NGX_DECLINED should be returned so we keep accepting requests if there is a problem with ngx_http_limit_zone_module rather than blocking by default.</div>

<div><br></div><div>I attached a diff for the proposed modification below.</div><div><br></div><div>Thank you,</div><div>Matthieu.</div><div><br></div><div><br></div><div><br></div><div><div>diff --git a/src/http/modules/ngx_http_limit_zone_module.c b/src/http/modules/ngx_http_limit_zone_module.c</div>

<div>index 36da49c..5a20d8c 100644</div><div>--- a/src/http/modules/ngx_http_limit_zone_module.c</div><div>+++ b/src/http/modules/ngx_http_limit_zone_module.c</div><div>@@ -235,7 +235,7 @@ ngx_http_limit_zone_handler(ngx_http_request_t *r)</div>

<div>     node = ngx_slab_alloc_locked(shpool, n);</div><div>     if (node == NULL) {</div><div>         ngx_shmtx_unlock(&amp;shpool-&gt;mutex);</div><div>-        return NGX_HTTP_SERVICE_UNAVAILABLE;</div><div>+        return NGX_DECLINED;</div>

<div>     }</div><div><br></div><div>     lz = (ngx_http_limit_zone_node_t *) &amp;node-&gt;color;</div></div>