From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.haj.ipfire.org (localhost [IPv6:::1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4jfjV81W2dz2xhB for ; Wed, 02 Dec 2026 16:13:20 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1 raw public key) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "YR1" (not verified)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4jfjV812tBz2xgB for ; Wed, 02 Dec 2026 16:13:20 +0000 (UTC) Received: from people01.haj.ipfire.org (people01.haj.ipfire.org [IPv6:2001:678:b28::161]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bit raw public key) server-digest SHA256 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "people01.haj.ipfire.org", Issuer "YE1" (not verified)) by mail01.ipfire.org (Postfix) with ESMTPS id 4jfjV71qhLz5PQ for ; Wed, 02 Dec 2026 16:13:19 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1796227999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=z5sxi4l1VS8VLhVyaSOAMEnWCzL0HdabQA2MiRuTSIk=; b=LpK/f6i5z7mIJsu5eY9HCXIyYQhtYsy89b/FcW5VlpbPuKY3pC3qtSxUBLXTo36IqAG8GD SX0k9V93iMz6CfBw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1796227999; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=z5sxi4l1VS8VLhVyaSOAMEnWCzL0HdabQA2MiRuTSIk=; b=XV0L2cVImqIE32Yd1PwfuTxz1iM9oT90GD72KGZloCz3OttW9ySdV7j4VtwsvPaFlcUmTC YZHNvB8iroZuYGPY1VqcCHDJ6+HgRqNC7WkvxV4D3qrEE7V1mOAHlHzGIQVdYkqcAcLpC5 nSWR4lw+kt38sZMwvHo4UXhkwgRqnmP/entS/IZoa+PMbu/DEwBPjUuMZ2gHPBn5L8nHla tu+M+Mj/LffF0s1BleTS1RYFyycmlGHp2vAL5ut/+b2GLVUBcPF3oFkVSmArZUwfysG9LQ VRThf772BEzPZ02Q4iNV7wuopScZKORY2/kriR9hfuuECvBso8cATFsuMY5yLg== Received: by people01.haj.ipfire.org (Postfix, from userid 1000) id 4jfjV61YxQz2xg0; Wed, 02 Dec 2026 16:13:18 +0000 (UTC) To: ipfire-scm@lists.ipfire.org Subject: [git.ipfire.org] IPFire 2.x development tree branch, master, updated. 004b1ce1dc6b63afce57f0f69876d44a45e9f87a X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 2ea8ebadf05c4e9766316418d71ac407da33e05c X-Git-Newrev: 004b1ce1dc6b63afce57f0f69876d44a45e9f87a Message-Id: <4jfjV61YxQz2xg0@people01.haj.ipfire.org> Date: Wed, 02 Dec 2026 16:13:17 +0000 (UTC) From: Michael Tremer Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "IPFire 2.x development tree". The branch, master has been updated via 004b1ce1dc6b63afce57f0f69876d44a45e9f87a (commit) via 24c801b0c65d3249a7bea7ae6f19ef729cade2fb (commit) from 2ea8ebadf05c4e9766316418d71ac407da33e05c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: config/knot-resolver/config.yaml | 4 +- lfs/knot-resolver | 2 + .../knot-resolver-6.4.2-tls-task-leak.patch | 28 +++++++++++++ src/patches/knot-resolver-6.4.2-workers-max.patch | 48 ++++++++++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/patches/knot-resolver-6.4.2-tls-task-leak.patch create mode 100644 src/patches/knot-resolver-6.4.2-workers-max.patch Difference in files: diff --git a/config/knot-resolver/config.yaml b/config/knot-resolver/config.yaml index 7a2dd29fb8..22d90f9ecd 100644 --- a/config/knot-resolver/config.yaml +++ b/config/knot-resolver/config.yaml @@ -14,8 +14,10 @@ network: do-ipv4: true do-ipv6: false -# Start as many workers as we have CPU threads +# Start as many workers as we have CPU threads, but not more than eight +# because every worker uses its own memory workers: auto +workers-max: 8 # Enable a persistent cache cache: diff --git a/lfs/knot-resolver b/lfs/knot-resolver index 3c9839d908..dc6984329c 100644 --- a/lfs/knot-resolver +++ b/lfs/knot-resolver @@ -72,6 +72,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/knot-resolver-6.5-keep-dst-ip.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/knot-resolver-6.4.2-api-socket-permissions.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/knot-resolver-6.4.2-workers-max.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/knot-resolver-6.4.2-tls-task-leak.patch cd $(DIR_APP) && meson setup \ --buildtype=release \ --prefix=/usr \ diff --git a/src/patches/knot-resolver-6.4.2-tls-task-leak.patch b/src/patches/knot-resolver-6.4.2-tls-task-leak.patch new file mode 100644 index 0000000000..44629c2b66 --- /dev/null +++ b/src/patches/knot-resolver-6.4.2-tls-task-leak.patch @@ -0,0 +1,28 @@ +daemon/worker: do not register tasks with sessions closed while sending + +When a write on a TLS connection to an upstream server cannot be completed +at once, kresd closes the session from within session2_wrap(). qr_task_send() +still returned success and added the task to the task list of the closed +session, which had already been cleaned up. The task was never freed again. + +Upstream: https://gitlab.nic.cz/knot/knot-resolver/-/work_items/967 + +diff --git a/daemon/worker.c b/daemon/worker.c +index 63d07a644..47e591754 100644 +--- a/daemon/worker.c ++++ b/daemon/worker.c +@@ -675,6 +675,14 @@ static int qr_task_send(struct qr_task *task, struct session2 *session, + payload.ttl = packet_ttl(pkt); + ret = session2_wrap(session, payload, comm, &task->ctx->req, qr_task_wrap_finished, task); + ++ /* The session might have been closed while sending (e.g. when the OS ++ * buffer was full). It has already been cleaned up by then, so the task ++ * must not be registered with it, or it would never be released. */ ++ if (ret >= 0 && session->closing) { ++ VERBOSE_MSG(NULL, "session closed while sending, not registering task\n"); ++ ret = kr_error(ECONNRESET); ++ } ++ + if (ret >= 0) { + session2_touch(session); + if (session->outgoing) { diff --git a/src/patches/knot-resolver-6.4.2-workers-max.patch b/src/patches/knot-resolver-6.4.2-workers-max.patch new file mode 100644 index 0000000000..0fb62df7a8 --- /dev/null +++ b/src/patches/knot-resolver-6.4.2-workers-max.patch @@ -0,0 +1,48 @@ +diff --git a/python/knot_resolver/datamodel/config_schema.py b/python/knot_resolver/datamodel/config_schema.py +--- a/python/knot_resolver/datamodel/config_schema.py ++++ b/python/knot_resolver/datamodel/config_schema.py +@@ -96,6 +96,7 @@ class KresConfig(ConfigSchema): + hostname: Internal DNS resolver hostname. Default is machine hostname. + rundir: Directory where the resolver can create files and which will be it's cwd. + workers: The number of running kresd (Knot Resolver daemon) workers. If set to 'auto', it is equal to number of CPUs available. ++ workers_max: The maximum number of kresd (Knot Resolver daemon) workers to start if 'workers' is set to 'auto'. + management: Configuration of management HTTP API. + options: Fine-tuning global parameters of DNS resolver operation. + network: Network connections and protocols configuration. +@@ -118,6 +119,7 @@ class KresConfig(ConfigSchema): + hostname: Optional[EscapedStr] = None + rundir: WritableDir = lazy_default(WritableDir, str(RUN_DIR)) + workers: Union[Literal["auto"], IntPositive] = IntPositive(1) ++ workers_max: Optional[IntPositive] = None + management: ManagementSchema = lazy_default(ManagementSchema, {"unix-socket": str(API_SOCK_FILE)}) + options: OptionsSchema = OptionsSchema() + network: NetworkSchema = NetworkSchema() +@@ -141,6 +143,7 @@ class KresConfig(ConfigSchema): + hostname: EscapedStr + rundir: WritableDir + workers: IntPositive ++ workers_max: Optional[IntPositive] + management: ManagementSchema + options: OptionsSchema + network: NetworkSchema +@@ -180,6 +183,9 @@ class KresConfig(ConfigSchema): + + count = _cpu_count() + if count: ++ # do not start more workers than allowed ++ if obj.workers_max is not None: ++ count = min(count, int(obj.workers_max)) + return IntPositive(count) + raise ValueError( + "The number of available CPUs to automatically set the number of running 'kresd' workers could not be determined." +diff --git a/python/knot_resolver/manager/manager.py b/python/knot_resolver/manager/manager.py +--- a/python/knot_resolver/manager/manager.py ++++ b/python/knot_resolver/manager/manager.py +@@ -118,6 +118,7 @@ class KresManager: # pylint: disable=too-many-instance-attributes + config.hostname, + # config.rundir not allowed to change + config.workers, ++ # config.workers_max is already reflected in config.workers + # config.management not allowed to change and not affecting workers anyway + config.options, + config.network, hooks/post-receive -- IPFire 2.x development tree