This issue seems to occur repeatedly when multiple incoming messages arrive simultaneously (under test conditions, all to the same recipient and all triggering the same MailScript/Sieve rules).
Since we can't currently compiled libsieve (blocker, see [LBBS-31]), it's hard to say whether this is a bug in the library or our usage of it.
[2025-07-29 18:45:02.815] DEBUG[270367]: mod_sieve.c:421 my_getheader: Header 'X-Spam-Level' appears 0 times
[2025-07-29 18:45:02.823] DEBUG[270367]: mod_sieve.c:558 script_exec: Action not taken
[2025-07-29 18:45:02.826] DEBUG[270367]: mod_smtp_delivery_local.c:244 do_local_delivery: Running SMTP callbacks for INDIVIDUAL scope, IN (IN) direction, post-mailbox pass
[2025-07-29 18:45:02.828] DEBUG[270367]: mod_mailscript.c:626 run_rules: MailScript /home/bbs/maildir/after.rules doesn't exist
[2025-07-29 18:45:02.821] DEBUG[270368]: mod_sieve.c:421 my_getheader: Header 'X-Spam-Level' appears 0 times
[2025-07-29 18:45:02.830] DEBUG[270368]: mod_sieve.c:558 script_exec: Action not taken
==270337== Thread 19:
==270337== Invalid read of size 8
==270337== at 0xBFA4170: libsieve_strbuffree (in /usr/lib/x86_64-linux-gnu/libsieve.so.1.0.5)
==270337== by 0xBFA6D24: libsieve_addrlexfree (in /usr/lib/x86_64-linux-gnu/libsieve.so.1.0.5)
==270337== by 0xBFB19CE: sieve2_free (in /usr/lib/x86_64-linux-gnu/libsieve.so.1.0.5)
==270337== by 0xBF90BEF: script_exec (mod_sieve.c:561)
==270337== by 0xBF90EAA: sieve (mod_sieve.c:616)
==270337== by 0x62D33FB: __run_callbacks (net_smtp.c:1926)
==270337== by 0x62D353C: __smtp_run_callbacks (net_smtp.c:1950)
==270337== by 0x62D380B: __smtp_run_delivery_callbacks (net_smtp.c:2031)
==270337== by 0xC00EE47: do_local_delivery (mod_smtp_delivery_local.c:244)
==270337== by 0x62D5421: expand_and_deliver (net_smtp.c:2544)
==270337== by 0x62D7C66: do_deliver (net_smtp.c:3105)
==270337== by 0x62D9FA6: handle_data (net_smtp.c:3367)
==270337== Address 0x10 is not stack'd, malloc'd or (recently) free'd
Thread 1 (Thread 0x7f405aff5700 (LWP 270115)):
#0 0x00007f407c2b0170 in libsieve_strbuffree () at /lib/x86_64-linux-gnu/libsieve.so.1
#1 0x00007f407c2b2d25 in libsieve_addrlexfree () at /lib/x86_64-linux-gnu/libsieve.so.1
#2 0x00007f407c2bd9cf in sieve2_free () at /lib/x86_64-linux-gnu/libsieve.so.1
#3 0x00007f407c2e3bf0 in script_exec (mproc=0x7f405aff3950, scriptfile=0x7f405aff3490 "/home/bbs/maildir/1/.sieve") at mod_sieve.c:561
res = 0
sieve = {header = 0x7f4064003a30, headers = 0x0, subaddress = 0x0, script_data = 0x7f406400d9b0 "require \"fileinto\";\r\nif header :contains \"X-Spam-Level\" \"*****\" {\r\n\tfileinto \"Junk\";\r\n}\r\n", errormsg = 0x0, scriptpath = "/home/bbs/maildir/1/.sieve", '\000' <repeats 237 times>, mproc = 0x7f405aff3950, error_parse = 0, error_runtime = 0, actiontaken = 0}
sieve2_context = 0x7f406400d3a0
__func__ = "script_exec"
#4 0x00007f407c2e3eab in sieve (mproc=0x7f405aff3950) at mod_sieve.c:616
script = "/home/bbs/maildir/1/.sieve\000"...
mboxmaildir = 0x7f405aff35a0 "/home/bbs/maildir/1"
#5 0x00007f4084a9c3fc in __run_callbacks (mproc=0x7f405aff3950, iteration=FILTER_MAILBOX, file=0x7f407c266068 "mod_smtp_delivery_local.c", line=244, func=0x7f407c266540 <__func__.1> "do_local_delivery") at net_smtp.c:1926
You must be