Welcome! Log In Create A New Profile

Advanced

limit_zone memory exhausted

Matthieu Tourne
March 25, 2011 02:38PM
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;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

limit_zone memory exhausted

Matthieu Tourne 2132 March 25, 2011 02:38PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 197
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready