limit_zone memory exhausted
Matthieu Tourne
matthieu.tourne at gmail.com
Fri Mar 25 21:35:10 MSK 2011
Hi,
Yesterday error messages similar to this started filling up the logs :
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 "limit_inbound"
And more importantly nginx started returning "503 Service Temporary
Unavalaible" for every requests
The solution was simple, as to increase the memory assigned to the
limit_zone rbtree.
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.
I attached a diff for the proposed modification below.
Thank you,
Matthieu.
diff --git a/src/http/modules/ngx_http_limit_zone_module.c
b/src/http/modules/ngx_http_limit_zone_module.c
index 36da49c..5a20d8c 100644
--- a/src/http/modules/ngx_http_limit_zone_module.c
+++ b/src/http/modules/ngx_http_limit_zone_module.c
@@ -235,7 +235,7 @@ ngx_http_limit_zone_handler(ngx_http_request_t *r)
node = ngx_slab_alloc_locked(shpool, n);
if (node == NULL) {
ngx_shmtx_unlock(&shpool->mutex);
- return NGX_HTTP_SERVICE_UNAVAILABLE;
+ return NGX_DECLINED;
}
lz = (ngx_http_limit_zone_node_t *) &node->color;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-devel/attachments/20110325/5e3a3d4d/attachment.html>
More information about the nginx-devel
mailing list