From: Alan T. DeKok Date: Wed, 31 Jan 2018 15:40:26 +0000 (-0500) Subject: lower the limits on num_messages X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54e25ad8f7a4161cdf720c88a99991cd8a8967ff;p=thirdparty%2Ffreeradius-server.git lower the limits on num_messages which should drastically decrease the memory usage of the detail file reader --- diff --git a/src/modules/proto_detail/proto_detail.c b/src/modules/proto_detail/proto_detail.c index 4a603e65924..2c49e4f1bdf 100644 --- a/src/modules/proto_detail/proto_detail.c +++ b/src/modules/proto_detail/proto_detail.c @@ -549,9 +549,9 @@ static int mod_instantiate(void *instance, CONF_SECTION *conf) */ if (!inst->max_packet_size) inst->max_packet_size = inst->app_io->default_message_size; - if (!inst->num_messages) inst->num_messages = 256; + if (!inst->num_messages) inst->num_messages = 2; - FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 32); + FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, >=, 2); FR_INTEGER_BOUND_CHECK("num_messages", inst->num_messages, <=, 65535); FR_INTEGER_BOUND_CHECK("max_packet_size", inst->max_packet_size, >=, 1024); diff --git a/src/modules/proto_detail/proto_detail_file.c b/src/modules/proto_detail/proto_detail_file.c index 148cb0e2e69..e0319d3c2e6 100644 --- a/src/modules/proto_detail/proto_detail_file.c +++ b/src/modules/proto_detail/proto_detail_file.c @@ -393,6 +393,14 @@ static int work_exists(proto_detail_file_t *inst, int fd) goto error; } + /* + * Limit the number of messages, retransmission, etc. + */ + if (work->max_outstanding < listen->num_messages) { + listen->num_messages = work->max_outstanding; + } + if (work->max_outstanding <= 1) work->max_outstanding = 2; + /* * Open the detail.work file. */