Welcome! Log In Create A New Profile

Advanced

[PATCH 3 of 5] Cache: only complain on long locked entries

Maxim Dounin
December 11, 2011 10:06AM
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1323615350 -10800
# Node ID 71a5724d332ff7cc5935e0f6c87e8a0036f3e682
# Parent a013347f89334734a7a0f65031895be52d87a5a0
Cache: only complain on long locked entries.

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.

diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -1113,12 +1113,12 @@ ngx_http_file_cache_expire(ngx_http_file
/*
* 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",

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH 0 of 5] cache patches

Maxim Dounin 1798 December 11, 2011 10:06AM

[PATCH 1 of 5] Cache: obsolete code removed

Maxim Dounin 723 December 11, 2011 10:06AM

[PATCH 2 of 5] Cache: handling of cache files with long headers

Maxim Dounin 906 December 11, 2011 10:06AM

[PATCH 3 of 5] Cache: only complain on long locked entries

Maxim Dounin 908 December 11, 2011 10:06AM

[PATCH 4 of 5] Cache locks initial implementation

Maxim Dounin 873 December 11, 2011 10:06AM

[PATCH 5 of 5] Cache lock support for fastcgi, scgi, uwsgi

Maxim Dounin 723 December 11, 2011 10:08AM

Re: [PATCH 0 of 5] cache patches

fanboy 983 December 11, 2011 07:00PM

Re: [PATCH 0 of 5] cache patches

Maxim Dounin 780 December 12, 2011 04:54AM

Re: [PATCH 0 of 5] cache patches

António P. P. Almeida 758 December 11, 2011 07:10PM

Re: [PATCH 0 of 5] cache patches

Maxim Dounin 733 December 12, 2011 05:02AM

Re: [PATCH 0 of 5] cache patches

António P. P. Almeida 709 December 12, 2011 05:28AM

Re: [PATCH 0 of 5] cache patches

Maxim Dounin 766 December 12, 2011 05:36AM

Re: [PATCH 0 of 5] cache patches

António P. P. Almeida 1032 December 13, 2011 02:42PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 102
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready