]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] Hyperscan cache: use Lua backend for sync loading, load on worker startup
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 4 Feb 2026 13:48:00 +0000 (13:48 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 4 Feb 2026 13:48:00 +0000 (13:48 +0000)
commit2df7e153c50176490d5ae8d2ca7c0f0bb1e6a5d8
tree9994273e0b440857086c4a041c80fc31d228b7e9
parentba35d63be787c3d76f04b0604a83b033f3af5efe
[Fix] Hyperscan cache: use Lua backend for sync loading, load on worker startup

Two issues addressed:

1. Sync loading now uses Lua backend exclusively instead of duplicating
   file loading logic in C. The Lua backend handles files, compression,
   and future backends (redis, http) uniformly.

2. Workers now proactively load hyperscan on startup after Lua backend
   is initialized. This fixes a race condition where workers spawned
   after hs_helper broadcasts HYPERSCAN_LOADED would never receive the
   notification and run without hyperscan acceleration.

Changes:
- Add rspamd_hs_cache_lua_load_sync() and rspamd_hs_cache_lua_exists_sync()
  to call Lua backend's sync methods from C
- Remove duplicated C file loading code from re_cache.c (zstd decompress,
  file path checking) - Lua backend handles this
- rspamd_re_cache_load_hyperscan() now requires Lua backend
- Workers try sync load on startup (best-effort, falls back to PCRE)
src/libserver/hs_cache_backend.c
src/libserver/hs_cache_backend.h
src/libserver/re_cache.c
src/libserver/worker_util.c