comparison src/http/modules/ngx_http_limit_req_module.c @ 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 2bce3f6416c6
comparison
equal deleted inserted replaced
2375:95004b25476c 2376:29d89920a749
176 176
177 if (rc == NGX_BUSY) { 177 if (rc == NGX_BUSY) {
178 ngx_shmtx_unlock(&ctx->shpool->mutex); 178 ngx_shmtx_unlock(&ctx->shpool->mutex);
179 179
180 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 180 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
181 "limiting requests, excess: %ui.%03ui", 181 "limiting requests, excess: %ui.%03ui by zone \"%V\"",
182 excess / 1000, excess % 1000); 182 excess / 1000, excess % 1000, &lrcf->shm_zone->name);
183 183
184 return NGX_HTTP_SERVICE_UNAVAILABLE; 184 return NGX_HTTP_SERVICE_UNAVAILABLE;
185 } 185 }
186 186
187 if (rc == NGX_AGAIN) { 187 if (rc == NGX_AGAIN) {
190 if (lrcf->nodelay) { 190 if (lrcf->nodelay) {
191 return NGX_DECLINED; 191 return NGX_DECLINED;
192 } 192 }
193 193
194 ngx_log_error(NGX_LOG_WARN, r->connection->log, 0, 194 ngx_log_error(NGX_LOG_WARN, r->connection->log, 0,
195 "delaying request, excess: %ui.%03ui", 195 "delaying request, excess: %ui.%03ui, by zone \"%V\"",
196 excess / 1000, excess % 1000); 196 excess / 1000, excess % 1000, &lrcf->shm_zone->name);
197 197
198 if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) { 198 if (ngx_handle_read_event(r->connection->read, 0) != NGX_OK) {
199 return NGX_HTTP_INTERNAL_SERVER_ERROR; 199 return NGX_HTTP_INTERNAL_SERVER_ERROR;
200 } 200 }
201 201
222 ngx_http_limit_req_expire(ctx, 0); 222 ngx_http_limit_req_expire(ctx, 0);
223 223
224 node = ngx_slab_alloc_locked(ctx->shpool, n); 224 node = ngx_slab_alloc_locked(ctx->shpool, n);
225 if (node == NULL) { 225 if (node == NULL) {
226 ngx_shmtx_unlock(&ctx->shpool->mutex); 226 ngx_shmtx_unlock(&ctx->shpool->mutex);
227
228 ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
229 "could not allocate memory in zone \"%V\"",
230 &lrcf->shm_zone->name);
231
227 return NGX_HTTP_SERVICE_UNAVAILABLE; 232 return NGX_HTTP_SERVICE_UNAVAILABLE;
228 } 233 }
229 } 234 }
230 235
231 lr = (ngx_http_limit_req_node_t *) &node->color; 236 lr = (ngx_http_limit_req_node_t *) &node->color;