Mercurial > hg > nginx
comparison src/http/ngx_http_file_cache.c @ 8005:dd718d1cef3c
Cache: fixed race in ngx_http_file_cache_forced_expire().
During configuration reload two cache managers might exist for a short
time. If both tried to delete the same cache node, the "ignore long locked
inactive cache entry" alert appeared in logs. Additionally,
ngx_http_file_cache_forced_expire() might be also called by worker
processes, with similar results.
Fix is to ignore cache nodes being deleted, similarly to how it is
done in ngx_http_file_cache_expire() since 3755:76e3a93821b1. This
was somehow missed in 7002:ab199f0eb8e8, when ignoring long locked
cache entries was introduced in ngx_http_file_cache_forced_expire().
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 01 Feb 2022 16:29:28 +0300 |
parents | 3781de64e747 |
children | 1c3b78d7cdc9 |
comparison
equal
deleted
inserted
replaced
8004:c0a432c0301b | 8005:dd718d1cef3c |
---|---|
1754 ngx_http_file_cache_delete(cache, q, name); | 1754 ngx_http_file_cache_delete(cache, q, name); |
1755 wait = 0; | 1755 wait = 0; |
1756 break; | 1756 break; |
1757 } | 1757 } |
1758 | 1758 |
1759 if (fcn->deleting) { | |
1760 wait = 1; | |
1761 break; | |
1762 } | |
1763 | |
1759 p = ngx_hex_dump(key, (u_char *) &fcn->node.key, | 1764 p = ngx_hex_dump(key, (u_char *) &fcn->node.key, |
1760 sizeof(ngx_rbtree_key_t)); | 1765 sizeof(ngx_rbtree_key_t)); |
1761 len = NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t); | 1766 len = NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t); |
1762 (void) ngx_hex_dump(p, fcn->key, len); | 1767 (void) ngx_hex_dump(p, fcn->key, len); |
1763 | 1768 |