From 6351307ab4cf4b0b190058d720ad35bfd345e63f Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Mon, 28 Jun 2010 12:50:04 +0000 Subject: [PATCH] - Fix the max number of reply-address count git-svn-id: file:///svn/unbound/trunk@2171 be551aaa-1e26-0410-a405-d3ace91eadb9 --- daemon/worker.c | 9 --------- daemon/worker.h | 3 --- doc/Changelog | 3 +++ services/mesh.c | 11 +++++++++++ 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/daemon/worker.c b/daemon/worker.c index b9863b223..c8df93389 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -906,14 +906,6 @@ worker_handle_request(struct comm_point* c, void* arg, int error, } /* grab a work request structure for this new request */ - if(worker->env.mesh->num_reply_addrs>worker->request_size*16) { - /* protect our memory usage from storing reply addresses */ - verbose(VERB_ALGO, "Too many requests queued. " - "dropping incoming query."); - worker->env.mesh->stats_dropped++; - comm_point_drop_reply(repinfo); - return 0; - } mesh_new_client(worker->env.mesh, &qinfo, ldns_buffer_read_u16_at(c->buffer, 2), &edns, repinfo, *(uint16_t*)ldns_buffer_begin(c->buffer)); @@ -1122,7 +1114,6 @@ worker_init(struct worker* worker, struct config_file *cfg, worker_delete(worker); return 0; } - worker->request_size = cfg->num_queries_per_thread; server_stats_init(&worker->stats, cfg); alloc_init(&worker->alloc, &worker->daemon->superalloc, diff --git a/daemon/worker.h b/daemon/worker.h index b1fa95eba..a2a234faa 100644 --- a/daemon/worker.h +++ b/daemon/worker.h @@ -102,9 +102,6 @@ struct worker { /** timer for statistics */ struct comm_timer* stat_timer; - /** number of requests that can be handled by this worker */ - size_t request_size; - /** random() table for this worker. */ struct ub_randstate* rndstate; /** do we need to restart or quit (on signal) */ diff --git a/doc/Changelog b/doc/Changelog index a627f78b5..268fb31d6 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -6,6 +6,9 @@ / (average time for such long queries) qps for long queries. And about (numqueriesperthread / 2)/(jostletimeout in whole seconds) qps for short queries, per thread. + - Fix the max number of reply-address count to be applied for duplicate + queries, and not for new query list entries. This raises the memory + usage to a max of (16+1)*numqueriesperthread reply addresses. 25 June 2010: Wouter - Fix handling of corner case reply from lame server, follows rfc2308. diff --git a/services/mesh.c b/services/mesh.c index ca899ce98..04e9cebe4 100644 --- a/services/mesh.c +++ b/services/mesh.c @@ -283,6 +283,17 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo, mesh->stats_dropped ++; return; } + /* for this new reply state, the reply address is free, + * so the limit of reply addresses does not stop reply states*/ + } else { + /* protect our memory usage from storing reply addresses */ + if(mesh->num_reply_addrs > mesh->max_reply_states*16) { + verbose(VERB_ALGO, "Too many requests queued. " + "dropping incoming query."); + mesh->stats_dropped++; + comm_point_drop_reply(rep); + return; + } } /* see if it already exists, if not, create one */ if(!s) { -- 2.47.2