[nginx] Resolver: fixed a race between parallel name and addr resolves.

Dmitry Volyntsev xeioex at nginx.com
Fri Dec 16 15:22:15 UTC 2016


details:   http://hg.nginx.org/nginx/rev/c3a895b94d3f
branches:  
changeset: 6846:c3a895b94d3f
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Fri Dec 16 18:21:55 2016 +0300
description:
Resolver: fixed a race between parallel name and addr resolves.

Previously, ngx_resolve_name() and ngx_resolve_addr() may have
rescheduled the resend timer while it was already in progress.

diffstat:

 src/core/ngx_resolver.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 9abba5b70ea0 -r c3a895b94d3f src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c	Fri Dec 16 18:21:42 2016 +0300
+++ b/src/core/ngx_resolver.c	Fri Dec 16 18:21:55 2016 +0300
@@ -875,7 +875,7 @@ ngx_resolve_name_locked(ngx_resolver_t *
         ngx_add_timer(ctx->event, ctx->timeout);
     }
 
-    if (ngx_queue_empty(resend_queue)) {
+    if (ngx_resolver_resend_empty(r)) {
         ngx_add_timer(r->event, (ngx_msec_t) (r->resend_timeout * 1000));
     }
 
@@ -1098,7 +1098,7 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx
         ngx_add_timer(ctx->event, ctx->timeout);
     }
 
-    if (ngx_queue_empty(resend_queue)) {
+    if (ngx_resolver_resend_empty(r)) {
         ngx_add_timer(r->event, (ngx_msec_t) (r->resend_timeout * 1000));
     }
 


More information about the nginx-devel mailing list