]> git.kaiwu.me - nginx.git/commitdiff
Cache: only complain on long locked entries.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 12 Dec 2011 10:49:14 +0000 (10:49 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 12 Dec 2011 10:49:14 +0000 (10:49 +0000)
There have been multiple reports of cases where a real locked entry was
removed, resulting in a segmentation fault later in a worker which locked
the entry.  It looks like default inactive timeout isn't enough in real
life.

For now just ignore such locked entries, and move them to the top of the
inactive queue to allow processing of other entries.

src/http/ngx_http_file_cache.c

index cb329aa9b3d06ee0e7de542fdd0bcf402857bb6e..050f356f109ab71ebb5064e7632b98734b92d7a6 100644 (file)
@@ -1113,12 +1113,12 @@ ngx_http_file_cache_expire(ngx_http_file_cache_t *cache)
         /*
          * abnormally exited workers may leave locked cache entries,
          * and although it may be safe to remove them completely,
-         * we prefer to remove them from inactive queue and rbtree
-         * only, and to allow other leaks
+         * we prefer to just move them to the top of the inactive queue
          */
 
         ngx_queue_remove(q);
-        ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
+        fcn->expire = ngx_time() + cache->inactive;
+        ngx_queue_insert_head(&cache->sh->queue, &fcn->queue);
 
         ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
                       "ignore long locked inactive cache entry %*s, count:%d",