]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] re_cache: Use debug level for missing Lua backend during config
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 5 Feb 2026 09:47:44 +0000 (09:47 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 5 Feb 2026 09:47:44 +0000 (09:47 +0000)
During config initialization (configtest, startup), there's no event
loop available so the Lua backend cannot be initialized. This is
expected behavior - use debug level when try_load=true to avoid
noisy warnings during configtest.

src/libserver/re_cache.c

index 16cd713c0561c97e41b244ba0e0764afcc1c5c1b..39606eb01868c92c08b5140b0602f2178c7ecbff 100644 (file)
@@ -3196,10 +3196,23 @@ rspamd_re_cache_load_hyperscan(struct rspamd_re_cache *cache,
 
        /* Lua backend is required for sync loading */
        if (!rspamd_hs_cache_has_lua_backend()) {
-               msg_warn_re_cache("no Lua backend available for synchronous hyperscan loading%s%s%s",
-                                                 cache->scope ? " for scope '" : "",
-                                                 cache->scope ? cache->scope : "",
-                                                 cache->scope ? "'" : "");
+               /*
+                * During config init (try_load=true), no event loop is available,
+                * so Lua backend can't be initialized. This is expected - use debug level.
+                * Workers will initialize the backend and load databases properly.
+                */
+               if (try_load) {
+                       msg_debug_re_cache("no Lua backend available for synchronous hyperscan loading%s%s%s",
+                                                          cache->scope ? " for scope '" : "",
+                                                          cache->scope ? cache->scope : "",
+                                                          cache->scope ? "'" : "");
+               }
+               else {
+                       msg_warn_re_cache("no Lua backend available for synchronous hyperscan loading%s%s%s",
+                                                         cache->scope ? " for scope '" : "",
+                                                         cache->scope ? cache->scope : "",
+                                                         cache->scope ? "'" : "");
+               }
                cache->hyperscan_loaded = RSPAMD_HYPERSCAN_LOAD_ERROR;
                return cache->hyperscan_loaded;
        }