changeset 2376:29d89920a749

*) add zone name while logging 503 error reason *) log allocation error as 503 error reason
author Igor Sysoev <igor@sysoev.ru>
date Mon, 08 Dec 2008 14:18:06 +0000
parents 95004b25476c
children 87b8c44906b5
files src/http/modules/ngx_http_limit_req_module.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/modules/ngx_http_limit_req_module.c
+++ b/src/http/modules/ngx_http_limit_req_module.c
@@ -178,8 +178,8 @@ ngx_http_limit_req_handler(ngx_http_requ
         ngx_shmtx_unlock(&ctx->shpool->mutex);
 
         ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
-                      "limiting requests, excess: %ui.%03ui",
-                      excess / 1000, excess % 1000);
+                      "limiting requests, excess: %ui.%03ui by zone \"%V\"",
+                      excess / 1000, excess % 1000, &lrcf->shm_zone->name);
 
         return NGX_HTTP_SERVICE_UNAVAILABLE;
     }
@@ -192,8 +192,8 @@ ngx_http_limit_req_handler(ngx_http_requ
         }
 
         ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
-                      "delaying request, excess: %ui.%03ui",
-                      excess / 1000, excess % 1000);
+                      "delaying request, excess: %ui.%03ui, by zone \"%V\"",
+                      excess / 1000, excess % 1000, &lrcf->shm_zone->name);
 
         if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) {
             return NGX_HTTP_INTERNAL_SERVER_ERROR;
@@ -224,6 +224,11 @@ ngx_http_limit_req_handler(ngx_http_requ
         node = ngx_slab_alloc_locked(ctx->shpool, n);
         if (node == NULL) {
             ngx_shmtx_unlock(&ctx->shpool->mutex);
+
+            ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
+                          "could not allocate memory in zone \"%V\"",
+                          &lrcf->shm_zone->name);
+
             return NGX_HTTP_SERVICE_UNAVAILABLE;
         }
     }