mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
pickup worker events, and free them.
exponential backoff for continuously failing zones. git-svn-id: file:///svn/unbound/trunk@4479 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
10cd092a78
commit
c834b5eecd
4 changed files with 36 additions and 1 deletions
|
|
@ -695,6 +695,8 @@ daemon_cleanup(struct daemon* daemon)
|
||||||
daemon->respip_set = NULL;
|
daemon->respip_set = NULL;
|
||||||
views_delete(daemon->views);
|
views_delete(daemon->views);
|
||||||
daemon->views = NULL;
|
daemon->views = NULL;
|
||||||
|
auth_zones_delete(daemon->env->auth_zones);
|
||||||
|
daemon->env->auth_zones = NULL;
|
||||||
/* key cache is cleared by module desetup during next daemon_fork() */
|
/* key cache is cleared by module desetup during next daemon_fork() */
|
||||||
daemon_remote_clear(daemon->rc);
|
daemon_remote_clear(daemon->rc);
|
||||||
for(i=0; i<daemon->num; i++)
|
for(i=0; i<daemon->num; i++)
|
||||||
|
|
@ -728,7 +730,6 @@ daemon_delete(struct daemon* daemon)
|
||||||
rrset_cache_delete(daemon->env->rrset_cache);
|
rrset_cache_delete(daemon->env->rrset_cache);
|
||||||
infra_delete(daemon->env->infra_cache);
|
infra_delete(daemon->env->infra_cache);
|
||||||
edns_known_options_delete(daemon->env);
|
edns_known_options_delete(daemon->env);
|
||||||
auth_zones_delete(daemon->env->auth_zones);
|
|
||||||
}
|
}
|
||||||
ub_randfree(daemon->rand);
|
ub_randfree(daemon->rand);
|
||||||
alloc_clear(&daemon->superalloc);
|
alloc_clear(&daemon->superalloc);
|
||||||
|
|
|
||||||
|
|
@ -1738,6 +1738,14 @@ worker_init(struct worker* worker, struct config_file *cfg,
|
||||||
comm_timer_set(worker->env.probe_timer, &tv);
|
comm_timer_set(worker->env.probe_timer, &tv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* zone transfer tasks, setup once per process, if any */
|
||||||
|
if(worker->env.auth_zones
|
||||||
|
#ifndef THREADS_DISABLED
|
||||||
|
&& worker->thread_num == 0
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
|
auth_xfer_pickup_initial(worker->env.auth_zones, &worker->env);
|
||||||
|
}
|
||||||
if(!worker->env.mesh || !worker->env.scratch_buffer) {
|
if(!worker->env.mesh || !worker->env.scratch_buffer) {
|
||||||
worker_delete(worker);
|
worker_delete(worker);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,8 @@
|
||||||
#define AUTH_PROBE_TIMEOUT_STOP 1000 /* msec */
|
#define AUTH_PROBE_TIMEOUT_STOP 1000 /* msec */
|
||||||
/* auth transfer timeout for TCP connections, in msec */
|
/* auth transfer timeout for TCP connections, in msec */
|
||||||
#define AUTH_TRANSFER_TIMEOUT 10000 /* msec */
|
#define AUTH_TRANSFER_TIMEOUT 10000 /* msec */
|
||||||
|
/* auth transfer max backoff for failed tranfers and probes */
|
||||||
|
#define AUTH_TRANSFER_MAX_BACKOFF 86400 /* sec */
|
||||||
|
|
||||||
/** pick up nextprobe task to start waiting to perform transfer actions */
|
/** pick up nextprobe task to start waiting to perform transfer actions */
|
||||||
static void xfr_set_timeout(struct auth_xfer* xfr, struct module_env* env,
|
static void xfr_set_timeout(struct auth_xfer* xfr, struct module_env* env,
|
||||||
|
|
@ -5086,6 +5088,21 @@ xfr_set_timeout(struct auth_xfer* xfr, struct module_env* env,
|
||||||
if(xfr->expiry < wait)
|
if(xfr->expiry < wait)
|
||||||
xfr->task_nextprobe->next_probe += xfr->expiry;
|
xfr->task_nextprobe->next_probe += xfr->expiry;
|
||||||
else xfr->task_nextprobe->next_probe += wait;
|
else xfr->task_nextprobe->next_probe += wait;
|
||||||
|
if(!failure) xfr->task_nextprobe->backoff = 0;
|
||||||
|
} else {
|
||||||
|
if(!failure) {
|
||||||
|
xfr->task_nextprobe->backoff = 0;
|
||||||
|
} else {
|
||||||
|
if(xfr->task_nextprobe->backoff == 0)
|
||||||
|
xfr->task_nextprobe->backoff = 3;
|
||||||
|
else xfr->task_nextprobe->backoff *= 2;
|
||||||
|
if(xfr->task_nextprobe->backoff >
|
||||||
|
AUTH_TRANSFER_MAX_BACKOFF)
|
||||||
|
xfr->task_nextprobe->backoff =
|
||||||
|
AUTH_TRANSFER_MAX_BACKOFF;
|
||||||
|
}
|
||||||
|
xfr->task_nextprobe->next_probe +=
|
||||||
|
xfr->task_nextprobe->backoff;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!xfr->task_nextprobe->timer) {
|
if(!xfr->task_nextprobe->timer) {
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,8 @@ struct auth_nextprobe {
|
||||||
/* module env for this task */
|
/* module env for this task */
|
||||||
struct module_env* env;
|
struct module_env* env;
|
||||||
|
|
||||||
|
/** increasing backoff for failures */
|
||||||
|
time_t backoff;
|
||||||
/** Timeout for next probe (for SOA) */
|
/** Timeout for next probe (for SOA) */
|
||||||
time_t next_probe;
|
time_t next_probe;
|
||||||
/** timeout callback for next_probe or expiry(if that is sooner).
|
/** timeout callback for next_probe or expiry(if that is sooner).
|
||||||
|
|
@ -431,6 +433,13 @@ struct auth_zones* auth_zones_create(void);
|
||||||
int auth_zones_apply_cfg(struct auth_zones* az, struct config_file* cfg,
|
int auth_zones_apply_cfg(struct auth_zones* az, struct config_file* cfg,
|
||||||
int setup);
|
int setup);
|
||||||
|
|
||||||
|
/** initial pick up of worker timeouts, ties events to worker event loop
|
||||||
|
* @param az: auth zones structure
|
||||||
|
* @param env: worker env, of first worker that receives the events (if any)
|
||||||
|
* in its eventloop.
|
||||||
|
*/
|
||||||
|
void auth_xfer_pickup_initial(struct auth_zones* az, struct module_env* env);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete auth zones structure
|
* Delete auth zones structure
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue