mirror of
https://github.com/nginx/nginx.git
synced 2026-11-20 07:02:58 +00:00
Resolver: report error on CNAME restart failure
Previously, if restarting a resolve with a CNAME name failed due to a memory allocation error, no error was reported. The waiting requests were left detached from any node until their timeouts expired. Now the error is reported to the waiting requests immediately.
This commit is contained in:
parent
c51ffa2d1a
commit
8492a8b8a9
1 changed files with 32 additions and 2 deletions
|
|
@ -2550,7 +2550,22 @@ ngx_resolver_process_a(ngx_resolver_t *r, u_char *buf, size_t n,
|
|||
next->node = NULL;
|
||||
}
|
||||
|
||||
(void) ngx_resolve_name_locked(r, ctx, &name);
|
||||
if (ngx_resolve_name_locked(r, ctx, &name) == NGX_ERROR) {
|
||||
|
||||
/* unlock name mutex */
|
||||
|
||||
do {
|
||||
ctx->state = NGX_ERROR;
|
||||
ctx->valid = ngx_time() + (r->valid ? r->valid : 10);
|
||||
next = ctx->next;
|
||||
|
||||
ctx->handler(ctx);
|
||||
|
||||
ctx = next;
|
||||
} while (ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* unlock name mutex */
|
||||
|
|
@ -2935,7 +2950,22 @@ ngx_resolver_process_srv(ngx_resolver_t *r, u_char *buf, size_t n,
|
|||
next->node = NULL;
|
||||
}
|
||||
|
||||
(void) ngx_resolve_name_locked(r, ctx, &name);
|
||||
if (ngx_resolve_name_locked(r, ctx, &name) == NGX_ERROR) {
|
||||
|
||||
/* unlock name mutex */
|
||||
|
||||
do {
|
||||
ctx->state = NGX_ERROR;
|
||||
ctx->valid = ngx_time() + (r->valid ? r->valid : 10);
|
||||
next = ctx->next;
|
||||
|
||||
ctx->handler(ctx);
|
||||
|
||||
ctx = next;
|
||||
} while (ctx);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* unlock name mutex */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue