Blob Blame History Raw
From 64dbfdfe3ed2fc8f252ce138f6213b529edb2407 Mon Sep 17 00:00:00 2001
Message-Id: <64dbfdfe3ed2fc8f252ce138f6213b529edb2407@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 15 Feb 2023 10:48:31 +0100
Subject: [PATCH] rpc: Don't warn about "max_client_requests" in
 single-threaded daemons
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The warning about max_client_requests is hit inside virtlogd every time
a VM starts which spams the logs.

Emit the warning only when the client request limit is not 1 and add a
warning into the daemon config to not configure it too low instead.

Fixes: 031878c2364
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2145188
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
(cherry picked from commit b3f8e072fe08a6beaf3ec3d27e02efee4358b2ca)
---
 src/remote/libvirtd.conf.in  | 1 +
 src/rpc/virnetserverclient.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/remote/libvirtd.conf.in b/src/remote/libvirtd.conf.in
index 80a98b1529..32a680317a 100644
--- a/src/remote/libvirtd.conf.in
+++ b/src/remote/libvirtd.conf.in
@@ -374,6 +374,7 @@
 # connection. To avoid one client monopolizing the server
 # this should be a small fraction of the global max_workers
 # parameter.
+# Setting this too low may cause keepalive timeouts.
 #max_client_requests = 5
 
 # Same processing controls, but this time for the admin interface.
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index b5c764b1b0..bdb3552c5d 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -1261,7 +1261,8 @@ static virNetMessage *virNetServerClientDispatchRead(virNetServerClient *client)
             client->rx->bufferLength = VIR_NET_MESSAGE_LEN_MAX;
             client->rx->buffer = g_new0(char, client->rx->bufferLength);
             client->nrequests++;
-        } else if (!client->nrequests_warning) {
+        } else if (!client->nrequests_warning &&
+                   client->nrequests_max > 1) {
             client->nrequests_warning = true;
             VIR_WARN("Client hit max requests limit %zd. This may result "
                      "in keep-alive timeouts. Consider tuning the "
-- 
2.39.1