]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Fix] re_cache: Use debug level for startup hyperscan load failures
authorVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 5 Feb 2026 09:14:22 +0000 (09:14 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Thu, 5 Feb 2026 09:14:22 +0000 (09:14 +0000)
During worker startup, a "best-effort" synchronous hyperscan load is
attempted before hs_helper has finished compiling. When files don't
exist yet, the "no valid expressions" message was logged at info level,
which is noisy and misleading since this is expected startup behavior.

Changed to use debug level when try_load=true (startup probe), while
keeping info level for actual failures. Workers will receive async
notifications when hs_helper finishes compiling.

src/libserver/re_cache.c

index fc3e1e956a2d4e150e31b30c8b673e5693d5d34e..16cd713c0561c97e41b244ba0e0764afcc1c5c1b 100644 (file)
@@ -3342,13 +3342,30 @@ rspamd_re_cache_load_hyperscan(struct rspamd_re_cache *cache,
                }
        }
        else {
-               msg_info_re_cache("hyperscan database has NOT been loaded; no valid expressions (%ud classes)%s%s%s",
-                                                 total_classes,
-                                                 cache->scope ? " for scope '" : "",
-                                                 cache->scope ? cache->scope : "",
-                                                 cache->scope ? "'" : "");
-               if (missing_classes && missing_classes->len > 0) {
-                       msg_info_re_cache("all classes failed: %s", missing_classes->str);
+               /*
+                * During startup probe (try_load=true), "no valid expressions" is expected
+                * when hs_helper hasn't finished compiling yet. Use debug level to avoid
+                * log spam. Workers will receive async notifications when databases are ready.
+                */
+               if (try_load) {
+                       msg_debug_re_cache("hyperscan database has NOT been loaded; no valid expressions (%ud classes)%s%s%s",
+                                                          total_classes,
+                                                          cache->scope ? " for scope '" : "",
+                                                          cache->scope ? cache->scope : "",
+                                                          cache->scope ? "'" : "");
+                       if (missing_classes && missing_classes->len > 0) {
+                               msg_debug_re_cache("all classes failed (startup probe): %s", missing_classes->str);
+                       }
+               }
+               else {
+                       msg_info_re_cache("hyperscan database has NOT been loaded; no valid expressions (%ud classes)%s%s%s",
+                                                         total_classes,
+                                                         cache->scope ? " for scope '" : "",
+                                                         cache->scope ? cache->scope : "",
+                                                         cache->scope ? "'" : "");
+                       if (missing_classes && missing_classes->len > 0) {
+                               msg_info_re_cache("all classes failed: %s", missing_classes->str);
+                       }
                }
                cache->hyperscan_loaded = RSPAMD_HYPERSCAN_LOAD_ERROR;
        }