Re: MySQL Bayes store, and bayes_auto_expire, not auto-expiring
| Newsgroups | gmane.mail.spam.spamassassin.general |
|---|---|
| Message-ID | <[email protected]> |
On 10/30/25 11:19 AM, Jess Robinson wrote:
> Hi all,
>
> Asking here before I report a bug / attempt a patch.
>
> We noticed that with bayes_auto_expire set to true, using a MySQL bayes store, the auto-expiry does not run. The system has been up for several months, and the bayes_expire table remains empty. Manual --force-expire via sa-learn works ok once tried.
>
> Version: SA 4.0.0
> Scanning via exim / spamc
> Manual spam reporting: spamc -L
>
> After a large amount of code reading yesterday, I think this is because the MySQL BayesStore does not implement get_storage_variables - https://github.com/apache/spamassassin/blob/9e1677a6b73dc163c97bf382d9767856fe3ccbef/lib/Mail/SpamAssassin/BayesStore.pm#L570
>
from Mail::SpamAssassin::Conf
bayes_auto_expire (default: 1)
If enabled, the Bayes system will try to automatically expire old tokens from the database. Auto-expiry occurs when the number of tokens in the database surpasses the bayes_expiry_max_db_size value.
If a bayes datastore backend does not implement individual key/value expirations, the setting is silently ignored.
In MySQL storage, auto_expire has not been implemented, currently I am running "sa-learn --force-expire -u $user" for each user weekly.
Cheers
Giovanni
> This is used in expiry_due in BayesStore: https://github.com/apache/spamassassin/blob/9e1677a6b73dc163c97bf382d9767856fe3ccbef/lib/Mail/SpamAssassin/BayesStore.pm#L462
>
> which presumably dies instead.
>
> It was expected to run given the docs in sa-learn https://spamassassin.apache.org/full/4.0.x/doc/sa-learn.html#EXPIRATION which do not mention any bayesstore exceptions.
>
> Am I barking up the correct tree?
>
> Separately: is auto_expire recommended, or should we be creating some sort of cronjob to run thousands of user expiry calls manually?
>
> Thanks in advance,
>
> Jess Robinson / Runbox (setting up per-user spam training)
OpenPGP_signature.asc
(application/pgp-signature, 840 B)
-----BEGIN PGP SIGNATURE----- wsF5BAABCAAjFiEEqg3TnG6R3qYMxl94+r7qCYlyWOUFAmkF+MMFAwAAAAAACgkQ+r7qCYlyWOVr fRAAg9jyXbFT/gYzBay4Yz051cbWFcxEReIxe3j7DfrfX4KuCwnN7beX3on5nqx2iXInb9SV7/8H fiW3NQpCo1+ImjTYUDmD2vty1uPLF+YF9ZItWbbYGBVPNJ9YGvljAAvweYXQlewXS7i9O7gT1NZA xbrqlHkRAT6UV8AFYfyEbqUg4Tr7HwIymAsS9QmI7sW852zrDNjz9raAFu6l0yh/KVzMgQOz9VmC hHlAFipqMogRBd9hoF7FLYlqlTzGjNXrRHdegXZP9MBMnDnT3rEqjth108bbG+djLKtiV5+m3JgK LQoULUZ68dhkr7PphkL91mTIMvQnSfZFWdeB5FtP2MNFkl/bMw2FXx4rXc9g2wYzy/BJ8eKRTIPj KjCJb6QSQFHOnPR2gIihVWQP1ZhUMOIQj6d1pS/GwS99VLR5p5aEMsSX9FXJGVRFRxVcPbNBGXxa LuaPSJ3YBnvBqnHDA3uKQ3Tcj85q3ZvuQU5yKBitmJaZXD9mJUY22oJdByvRLK3a4/dGCoJIHc0m ADfeZ50eE+cn1OfM6cStEmNBuS2WiLVwwu+VRUWmu3SIxkV0E7ZfOA0Q82wsW4rePzY0iVNqeWTO ZZSDs4Sliql5xj6mFImS7RNyxTxyRy9dbe/9enKGDhaOjLJyeoRPE1LeOrIZqMnsu1W/VKB8K0o6 CNk= =2Eo5 -----END PGP SIGNATURE-----