]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Fix] Recreate invalid unserialized Hyperscan cache files on version mismatch 5724/head
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 3 Nov 2025 14:50:16 +0000 (14:50 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 3 Nov 2025 14:50:16 +0000 (14:50 +0000)
commitf661188f499424e58ada563f9f972b18a862c3b1
treeb53448d7ac116d82c8bd26b7576f05e454759291
parent6e49e901ad3da152afb3f8d591cf10486edf2534
[Fix] Recreate invalid unserialized Hyperscan cache files on version mismatch

When Hyperscan library is updated, previously cached .unser files become
invalid due to version mismatch. Previously, these files would remain
unusable, forcing fallback to slower deserialization on every load.

This commit adds automatic detection and recreation of invalid unserialized
files:
- Extract file creation logic into create_unserialized_file() helper function
- Add error handler that deletes and recreates invalid .unser files
- Maintain file locking protection against concurrent process access
- Fall back to serialized version if recreation fails

This ensures cache files are automatically updated after Hyperscan upgrades
while protecting against race conditions in multi-process environments.
src/libserver/hyperscan_tools.cxx