From 09496a7cd8e0ce77f34687849886b99c32118d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Mr=C3=A1zek?= Date: Mon, 3 Feb 2025 15:55:12 +0100 Subject: [PATCH 1/3] datamodel: policy-loader: added sleep after loading the config --- .../datamodel/templates/policy-config.lua.j2 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/python/knot_resolver/datamodel/templates/policy-config.lua.j2 b/python/knot_resolver/datamodel/templates/policy-config.lua.j2 index 9d88537a9..3fbb7cc11 100644 --- a/python/knot_resolver/datamodel/templates/policy-config.lua.j2 +++ b/python/knot_resolver/datamodel/templates/policy-config.lua.j2 @@ -40,7 +40,13 @@ cache.open({{ cfg.cache.size_max.bytes() }}, 'lmdb://{{ cfg.cache.storage }}') {% set disable_defer = true %} {% include "defer.lua.j2" %} - {% endif %} +-- This sleep() is necessary because of the possible +-- termination of the policy-loader before it is +-- added into starting_processes in sd_notify.py. +-- If this happens, the READY notification will end with an error. +worker.sleep(1) + +-- exit policy-loader properly quit() From 21a76cd86221761b4d8c3c2dce24720238150468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Mon, 3 Feb 2025 16:33:04 +0100 Subject: [PATCH 2/3] datamodel: policy-loader: avoid dependency on lua-cqueues --- daemon/lua/kres-gen-33.lua | 2 ++ daemon/lua/kres-gen.sh | 4 ++++ python/knot_resolver/datamodel/templates/policy-config.lua.j2 | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/daemon/lua/kres-gen-33.lua b/daemon/lua/kres-gen-33.lua index 9bf16b7f4..f37cc7c6a 100644 --- a/daemon/lua/kres-gen-33.lua +++ b/daemon/lua/kres-gen-33.lua @@ -11,6 +11,8 @@ struct timeval { __suseconds_t tv_usec; }; +unsigned sleep(unsigned seconds); + typedef struct knot_dump_style knot_dump_style_t; extern const knot_dump_style_t KR_DUMP_STYLE_DEFAULT; struct kr_cdb_api {}; diff --git a/daemon/lua/kres-gen.sh b/daemon/lua/kres-gen.sh index 910c5b75b..eeb101d85 100755 --- a/daemon/lua/kres-gen.sh +++ b/daemon/lua/kres-gen.sh @@ -62,6 +62,10 @@ struct timeval { __suseconds_t tv_usec; }; " +# We use this in policy-loader +printf " +unsigned sleep(unsigned seconds); +" ## Various types (mainly), from libknot and libkres diff --git a/python/knot_resolver/datamodel/templates/policy-config.lua.j2 b/python/knot_resolver/datamodel/templates/policy-config.lua.j2 index 3fbb7cc11..fbd824b38 100644 --- a/python/knot_resolver/datamodel/templates/policy-config.lua.j2 +++ b/python/knot_resolver/datamodel/templates/policy-config.lua.j2 @@ -46,7 +46,7 @@ cache.open({{ cfg.cache.size_max.bytes() }}, 'lmdb://{{ cfg.cache.storage }}') -- termination of the policy-loader before it is -- added into starting_processes in sd_notify.py. -- If this happens, the READY notification will end with an error. -worker.sleep(1) +C.sleep(1) -- exit policy-loader properly quit() From 5c5d1f72ae18dad7a117eb292284cac01a60ff81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Tue, 4 Feb 2025 14:57:21 +0100 Subject: [PATCH 3/3] NEWS entry for the policy-loader race --- NEWS | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NEWS b/NEWS index 3d2fc7fc5..2eb4e1546 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +Knot Resolver 6.0.11 (2025-0m-dd) +================================= + +Bugfixes +-------- +- manager: avoid an uncommon startup race in policy-loader (!1653) + [WARN] exited: policy-loader (exit status 0; not expected) + + Knot Resolver 6.0.10 (2025-01-20) =================================