mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
Cache: report error if slab allocator fails during cache loading.
This commit is contained in:
parent
348f705c00
commit
861e75dc20
@ -153,6 +153,8 @@ struct ngx_http_file_cache_s {
|
|||||||
|
|
||||||
time_t inactive;
|
time_t inactive;
|
||||||
|
|
||||||
|
time_t fail_time;
|
||||||
|
|
||||||
ngx_uint_t files;
|
ngx_uint_t files;
|
||||||
ngx_uint_t loader_files;
|
ngx_uint_t loader_files;
|
||||||
ngx_msec_t last;
|
ngx_msec_t last;
|
||||||
|
@ -2094,6 +2094,12 @@ ngx_http_file_cache_add(ngx_http_file_cache_t *cache, ngx_http_cache_t *c)
|
|||||||
fcn = ngx_slab_calloc_locked(cache->shpool,
|
fcn = ngx_slab_calloc_locked(cache->shpool,
|
||||||
sizeof(ngx_http_file_cache_node_t));
|
sizeof(ngx_http_file_cache_node_t));
|
||||||
if (fcn == NULL) {
|
if (fcn == NULL) {
|
||||||
|
if (cache->fail_time != ngx_time()) {
|
||||||
|
cache->fail_time = ngx_time();
|
||||||
|
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
|
||||||
|
"could not allocate node%s", cache->shpool->log_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
ngx_shmtx_unlock(&cache->shpool->mutex);
|
ngx_shmtx_unlock(&cache->shpool->mutex);
|
||||||
return NGX_ERROR;
|
return NGX_ERROR;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user