Created
July 30, 2020 07:18
-
-
Save kazeburo/904fdaa2bc82ccb989edcc9d6df24711 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ngx_http_upstream_dynamic_resolve_servers.c b/ngx_http_upstream_dynamic_resolve_servers.c | |
index 62ba520..48ec4eb 100644 | |
--- a/ngx_http_upstream_dynamic_resolve_servers.c | |
+++ b/ngx_http_upstream_dynamic_resolve_servers.c | |
@@ -640,27 +640,30 @@ reinit_upstream: | |
pool_queue = &dynamic_server->pool_queue; | |
- ngx_log_debug(NGX_LOG_DEBUG_CORE, ngx_cycle->log, 0, | |
+ ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0, | |
"upstream-dynamic-servers: server '%V' pool_queue_len is %i " | |
"before insert", | |
&dynamic_server->host, dynamic_server->pool_queue_len); | |
- for (p = pool_queue->next, n = p->next; p != pool_queue; | |
- p = n, n = n->next) | |
+ for (p = pool_queue->next, n = p->next; p != pool_queue && dynamic_server->pool_queue_len > 0; | |
+ p = n, | |
+ n = n->next) | |
{ | |
index++; | |
tmp_node = ngx_queue_data( | |
p, ngx_http_upstream_dynamic_resolve_server_pool_node_t, queue); | |
+ | |
if (tmp_node->refer_num == 0) | |
{ | |
ngx_queue_remove(p); | |
- | |
ngx_log_debug(NGX_LOG_DEBUG_CORE, ngx_cycle->log, 0, | |
"upstream-dynamic-servers: server '%V' %ith pool " | |
"will be destoried", | |
&dynamic_server->host, index); | |
- | |
- ngx_destroy_pool(tmp_node->pool); | |
+ if (tmp_node->pool) | |
+ { | |
+ ngx_destroy_pool(tmp_node->pool); | |
+ } | |
dynamic_server->pool_queue_len--; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment