Klaus Demo nginx / f62d460
Resolver: retry sending queries on errors (ticket #1511). Errors when sending UDP datagrams can happen, e.g., when local IP address changes (see fa0e093b64d7), or an unavailable DNS server on the LAN can cause send() to fail with EHOSTDOWN on BSD systems. If this happens during initial query, retry sending immediately, to a different DNS server when possible. If this is not enough, allow normal resend to happen by ignoring the return code of the second ngx_resolver_send_query() call, much like we do in ngx_resolver_resend(). Maxim Dounin 3 years ago
1 changed file(s) with 18 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
846846 rn->nsrvs = 0;
847847
848848 if (ngx_resolver_send_query(r, rn) != NGX_OK) {
849 goto failed;
849
850 /* immediately retry once on failure */
851
852 rn->last_connection++;
853 if (rn->last_connection == r->connections.nelts) {
854 rn->last_connection = 0;
855 }
856
857 (void) ngx_resolver_send_query(r, rn);
850858 }
851859
852860 if (ngx_resolver_set_timeout(r, ctx) != NGX_OK) {
10501058 rn->nsrvs = 0;
10511059
10521060 if (ngx_resolver_send_query(r, rn) != NGX_OK) {
1053 goto failed;
1061
1062 /* immediately retry once on failure */
1063
1064 rn->last_connection++;
1065 if (rn->last_connection == r->connections.nelts) {
1066 rn->last_connection = 0;
1067 }
1068
1069 (void) ngx_resolver_send_query(r, rn);
10541070 }
10551071
10561072 if (ngx_resolver_set_timeout(r, ctx) != NGX_OK) {