[LBBS-144] mod_smtp_delivery_external: Hang at shutdown if queue thread interrupted while busy
If there is an attempt to unload mod_smtp_delivery_external while it is in the middle of delivering a message, the queue thread is interrupted, but does not exit, leading to a hang as the queue thread continues on to calling bbs_safe_sleep_interrupt again.
[2026-03-04 22:14:46.632] === Unregistering module mod_smtp_delivery_local
[2026-03-04 22:14:46.633] -- Unloading mod_smtp_delivery_external.so, since it depends on net_smtp.so
[2026-03-04 22:14:46.633] DEBUG[3820198]: module.c:1019 unload_resource_nolock: Module mod_smtp_delivery_external.so has use count 0 (force: 1)
[2026-03-04 22:14:46.633] DEBUG[3820198]: module.c:1058 unload_resource_nolock: Unloading mod_smtp_delivery_external.so
[2026-03-04 22:14:46.633] DEBUG[3820198]: thread.c:303 bbs_pthread_interrupt: Signaling thread 140658878695104 with SIGURG
[2026-03-04 22:14:46.634] DEBUG[3819914]: bbs.c:806 __sig_catch_and_release_handler: Received signal 23 (Urgent I/O condition)
[2026-03-04 22:14:46.634] ERROR[3819914]: socket.c:578 __bbs_tcp_connect: connect: Interrupted system call
[2026-03-04 22:14:46.634] DEBUG[3819914]: mod_smtp_client.c:45 bbs_smtp_client_connect: Failed to set up TCP connection to REDACTED
...
[2026-03-04 22:14:46.636] DEBUG[3819914]: mod_smtp_delivery_external.c:1649 queue_handler: 1/1 message processed: 0 delivered, 0 failed, 1 delayed, 0 skipped
[2026-03-04 22:14:46.636] DEBUG[3820198]: thread.c:364 __bbs_pthread_join: Attempting to join thread 140658878695104 (LWP 3819914) at mod_smtp_delivery_external.c:2346 unload_module()
[2026-03-04 22:14:48.637] WARNING[3820198]: mod_smtp_delivery_external.c:2346 unload_module: Thread 3819914 is not currently waiting to be joined
[2026-03-04 22:14:48.637] DEBUG[3820198]: thread.c:392 __bbs_pthread_join: Thread 3819914 not yet joined after 2s
[2026-03-04 22:14:53.637] DEBUG[3820198]: thread.c:392 __bbs_pthread_join: Thread 3819914 not yet joined after 7s
n[2026-03-04 22:14:58.637] DEBUG[3820198]: thread.c:392 __bbs_pthread_join: Thread 3819914 not yet joined after 12s
Thread 84 (Thread 0x7fedb27fc6c0 (LWP 3819914) "lbbs"):
#0 0x00007fedc97a825f in __GI___poll (fds=0x7fedb27fbcb4, nfds=1, timeout=60000) at ../sysdeps/unix/sysv/linux/poll.c:29
sc_ret = -516
sc_cancel_oldtype = 0
#1 0x000055d585addd6f in __bbs_poll_interrupt (fd=4, ms=60000, abort_on_eintr=1) at socket.c:1532
pfd = {fd = 4, events = 59, revents = 0}
res = 32749
__func__ = "__bbs_poll_interrupt"
#2 0x000055d585addfb5 in bbs_poll_interrupt (fd=4, ms=60000) at socket.c:1576
#3 0x000055d585aa6f9e in bbs_safe_sleep_interrupt (ms=60000) at bbs.c:885
__func__ = "bbs_safe_sleep_interrupt"
#4 0x00007fedc0600918 in queue_handler (unused=0x0) at mod_smtp_delivery_external.c:1660
qrun = {type = QUEUE_RUN_PERIODIC, runstart = 1772662393, parallel = 0x0, match_filename = 0x0, host_match = 0x0, host_ends_with = 0x0, total = 1, processed = 1, delivered = 0, failed = 0, delayed>
__func__ = "queue_handler"
#5 0x000055d585aeb581 in thread_run (data=0x7feda81daa10) at thread.c:512Comments
You must be logged in to leave a comment.