Mercurial > hg > nginx-quic
comparison src/http/ngx_http_file_cache.c @ 3727:fd2bb219de22
change order
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 02 Aug 2010 12:32:33 +0000 |
parents | 282ddd49f925 |
children | a29bb11f8c80 |
comparison
equal
deleted
inserted
replaced
3726:282ddd49f925 | 3727:fd2bb219de22 |
---|---|
1020 ngx_log_debug6(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, | 1020 ngx_log_debug6(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, |
1021 "http file cache forced expire: #%d %d %02xd%02xd%02xd%02xd", | 1021 "http file cache forced expire: #%d %d %02xd%02xd%02xd%02xd", |
1022 fcn->count, fcn->exists, | 1022 fcn->count, fcn->exists, |
1023 fcn->key[0], fcn->key[1], fcn->key[2], fcn->key[3]); | 1023 fcn->key[0], fcn->key[1], fcn->key[2], fcn->key[3]); |
1024 | 1024 |
1025 if (fcn->count) { | 1025 if (fcn->count == 0) { |
1026 | 1026 ngx_http_file_cache_delete(cache, q, name); |
1027 | |
1028 } else { | |
1027 if (tries++ < 20) { | 1029 if (tries++ < 20) { |
1028 continue; | 1030 continue; |
1029 } | 1031 } |
1030 | 1032 |
1031 wait = 1; | 1033 wait = 1; |
1032 | 1034 } |
1033 break; | |
1034 } | |
1035 | |
1036 ngx_http_file_cache_delete(cache, q, name); | |
1037 | 1035 |
1038 break; | 1036 break; |
1039 } | 1037 } |
1040 | 1038 |
1041 ngx_shmtx_unlock(&cache->shpool->mutex); | 1039 ngx_shmtx_unlock(&cache->shpool->mutex); |
1095 ngx_log_debug6(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, | 1093 ngx_log_debug6(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, |
1096 "http file cache expire: #%d %d %02xd%02xd%02xd%02xd", | 1094 "http file cache expire: #%d %d %02xd%02xd%02xd%02xd", |
1097 fcn->count, fcn->exists, | 1095 fcn->count, fcn->exists, |
1098 fcn->key[0], fcn->key[1], fcn->key[2], fcn->key[3]); | 1096 fcn->key[0], fcn->key[1], fcn->key[2], fcn->key[3]); |
1099 | 1097 |
1100 if (fcn->count) { | 1098 if (fcn->count == 0) { |
1101 | 1099 ngx_http_file_cache_delete(cache, q, name); |
1102 p = ngx_hex_dump(key, (u_char *) &fcn->node.key, | |
1103 sizeof(ngx_rbtree_key_t)); | |
1104 | |
1105 len = NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t); | |
1106 (void) ngx_hex_dump(p, fcn->key, len); | |
1107 | |
1108 /* | |
1109 * abnormally exited workers may leave locked cache entries, | |
1110 * and although it may be safe to remove them completely, | |
1111 * we prefer to remove them from inactive queue and rbtree | |
1112 * only, and to allow other leaks | |
1113 */ | |
1114 | |
1115 ngx_queue_remove(q); | |
1116 ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node); | |
1117 | |
1118 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0, | |
1119 "ignore long locked inactive cache entry %*s, count:%d", | |
1120 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count); | |
1121 | |
1122 continue; | 1100 continue; |
1123 } | 1101 } |
1124 | 1102 |
1125 ngx_http_file_cache_delete(cache, q, name); | 1103 p = ngx_hex_dump(key, (u_char *) &fcn->node.key, |
1104 sizeof(ngx_rbtree_key_t)); | |
1105 len = NGX_HTTP_CACHE_KEY_LEN - sizeof(ngx_rbtree_key_t); | |
1106 (void) ngx_hex_dump(p, fcn->key, len); | |
1107 | |
1108 /* | |
1109 * abnormally exited workers may leave locked cache entries, | |
1110 * and although it may be safe to remove them completely, | |
1111 * we prefer to remove them from inactive queue and rbtree | |
1112 * only, and to allow other leaks | |
1113 */ | |
1114 | |
1115 ngx_queue_remove(q); | |
1116 ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node); | |
1117 | |
1118 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0, | |
1119 "ignore long locked inactive cache entry %*s, count:%d", | |
1120 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count); | |
1126 } | 1121 } |
1127 | 1122 |
1128 ngx_shmtx_unlock(&cache->shpool->mutex); | 1123 ngx_shmtx_unlock(&cache->shpool->mutex); |
1129 | 1124 |
1130 ngx_free(name); | 1125 ngx_free(name); |