From: Nick Porter Date: Mon, 8 Sep 2025 15:31:38 +0000 (+0100) Subject: Don't re-run garbage collection X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b5f8b5457fe3953e25883d34810a1e22b2cec48c;p=thirdparty%2Ffreeradius-server.git Don't re-run garbage collection `fr_control_message_alloc()` already attempts garbage collection if allocation from the ring buffer fails, so trying again like this will potentially result in 3 calls to `fr_control_gc()` when the buffer is full. --- diff --git a/src/lib/io/control.c b/src/lib/io/control.c index c387efb942..8653e50db3 100644 --- a/src/lib/io/control.c +++ b/src/lib/io/control.c @@ -304,18 +304,13 @@ int fr_control_message_push(fr_control_t *c, fr_ring_buffer_t *rb, uint32_t id, MPRINT("CONTROL push aq %p\n", c->aq); /* - * Get a message. If we can't get one, do garbage - * collection. Get another, and if that fails, we're - * done. + * Get a message. The alloc call attempts garbage collection + * if there is not enough free space. */ m = fr_control_message_alloc(c, rb, id, data, data_size); if (!m) { - (void) fr_control_gc(c, rb); - m = fr_control_message_alloc(c, rb, id, data, data_size); - if (!m) { - fr_strerror_const("Failed allocating after GC"); - return -2; - } + fr_strerror_const("Failed allocating after GC"); + return -2; } if (!fr_atomic_queue_push(c->aq, m)) {