mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
Core: slab log_nomem flag.
The flag allows to suppress "ngx_slab_alloc() failed: no memory" messages from a slab allocator, e.g., if an LRU expiration is used by a consumer and allocation failures aren't fatal. The flag is now used in the SSL session cache code, and in the limit_req module.
This commit is contained in:
@@ -129,6 +129,7 @@ ngx_slab_init(ngx_slab_pool_t *pool)
|
||||
pool->pages->slab = pages;
|
||||
}
|
||||
|
||||
pool->log_nomem = 1;
|
||||
pool->log_ctx = &pool->zero;
|
||||
pool->zero = '\0';
|
||||
}
|
||||
@@ -658,7 +659,10 @@ ngx_slab_alloc_pages(ngx_slab_pool_t *pool, ngx_uint_t pages)
|
||||
}
|
||||
}
|
||||
|
||||
ngx_slab_error(pool, NGX_LOG_CRIT, "ngx_slab_alloc() failed: no memory");
|
||||
if (pool->log_nomem) {
|
||||
ngx_slab_error(pool, NGX_LOG_CRIT,
|
||||
"ngx_slab_alloc() failed: no memory");
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user