aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/re_cache.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-02-25 13:36:41 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-02-25 13:37:56 +0000
commit33b3e51406f99224c63e79565272eaa62fcc39ed (patch)
tree16ef82a145e1e5339be46dd55ba4dcd43a289546 /src/libserver/re_cache.c
parent2da5b6d1b3d49b3f719e1522dbcebe0c0055ccc4 (diff)
downloadrspamd-33b3e51406f99224c63e79565272eaa62fcc39ed.tar.gz
rspamd-33b3e51406f99224c63e79565272eaa62fcc39ed.zip
[Fix] Treat `hs_allocate_scratch` errors as non-fatal
Issue: #4409
Diffstat (limited to 'src/libserver/re_cache.c')
-rw-r--r--src/libserver/re_cache.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c
index 37e792933..3f108fda5 100644
--- a/src/libserver/re_cache.c
+++ b/src/libserver/re_cache.c
@@ -2594,8 +2594,22 @@ rspamd_re_cache_load_hyperscan (struct rspamd_re_cache *cache,
if ((ret = hs_alloc_scratch (rspamd_hyperscan_get_database(re_class->hs_db),
&re_class->hs_scratch)) != HS_SUCCESS) {
- msg_err_re_cache ("fatal error: cannot allocate scratch for %s: %d", path, ret);
- g_abort();
+ rspamd_hyperscan_free (re_class->hs_db);
+ if (!try_load) {
+ msg_err_re_cache ("bad hs database in %s; error code: %d", path, ret);
+ }
+ else {
+ msg_debug_re_cache ("bad hs database in %s; error code: %d", path, ret);
+ }
+ g_free (hs_ids);
+ g_free (hs_flags);
+
+ re_class->hs_ids = NULL;
+ re_class->hs_scratch = NULL;
+ re_class->hs_db = NULL;
+ all_valid = FALSE;
+
+ continue;
}
/*