Control: tags -1 - moreinfo

On Sun, Jun 22, 2025 at 01:55:38PM -0400, Noah Meyerhans wrote:
> > > It seems likely that the sa-comple postinst and spamd postinst are
> > > racing with each other here.  I'm really surprised that this hasn't come
> > > up before...
> > 
> > A dpkg trigger allowing spamd's own postinst to restart the process,
> > rather than doing it directly from sa-compile's postinst, may resolve
> > the race condition.  Something like
> > https://salsa.debian.org/noahm/spamassassin/-/commit/991ad7c86f0bccb4d95dcc2de6e0eb42116b6f50
> 
> That commit was wrong; this one is better:
> https://salsa.debian.org/noahm/spamassassin/-/commit/2b3a32a070c2a739e8ade02e2d3f21bcfb20dc69
> 
> I had considered the possibility that even triggers wouldn't be
> necessary, and that we could just rely on spamd's postinst to restart
> the service (both spamd and sa-compile have versioned dependencies on
> spamassassin that will ensure that they're always upgraded together).
> However, because they don't have a direct dependency relationship, the
> order in which they're configured is nondeterministic.  So I do believe
> that sa-compile's postinst needs to ensure spamd is restarted, one way
> or another.

Triggers seem to do the right thing.  If spamd is configured before
sa-compile, then sa-compile's trigger causes spamd's postinst to restart
the server, as shown here:

root@satest-trixie:/var/cache/apt/archives# dpkg --unpack 
spamassassin_4.0.1-4+salsaci+20250622+103_all.deb                  
(Reading database ... 38350 files and directories currently installed.)
Preparing to unpack spamassassin_4.0.1-4+salsaci+20250622+103_all.deb ...
Unpacking spamassassin (4.0.1-4+salsaci+20250622+103) over (4.0.1-3) ...
Processing triggers for man-db (2.13.1-1) ...                                   
                                             
root@satest-trixie:/var/cache/apt/archives# dpkg --unpack 
spamd_4.0.1-4+salsaci+20250622+103_all.deb 
(Reading database ... 38350 files and directories currently installed.)         
                                             
Preparing to unpack spamd_4.0.1-4+salsaci+20250622+103_all.deb ...
Unpacking spamd (4.0.1-4+salsaci+20250622+103) over (4.0.1-3) ...               
                     
Processing triggers for man-db (2.13.1-1) ...                                   
                                             
root@satest-trixie:/var/cache/apt/archives# dpkg --unpack 
sa-compile_4.0.1-4+salsaci+20250622+103_all.deb 
(Reading database ... 38350 files and directories currently installed.)
Preparing to unpack sa-compile_4.0.1-4+salsaci+20250622+103_all.deb ...
Unpacking sa-compile (4.0.1-4+salsaci+20250622+103) over (4.0.1-3) ...
Processing triggers for man-db (2.13.1-1) ...
root@satest-trixie:/var/cache/apt/archives# dpkg --configure spamassassin
Setting up spamassassin (4.0.1-4+salsaci+20250622+103) ...
Installing new version of config file /etc/spamassassin/init.pre ...
Installing new version of config file /etc/spamassassin/v310.pre ...
Installing new version of config file /etc/spamassassin/v312.pre ...
Installing new version of config file /etc/spamassassin/v320.pre ...
Installing new version of config file /etc/spamassassin/v330.pre ...
Installing new version of config file /etc/spamassassin/v340.pre ...
Installing new version of config file /etc/spamassassin/v341.pre ...
Installing new version of config file /etc/spamassassin/v342.pre ...
Installing new version of config file /etc/spamassassin/v343.pre ...
Installing new version of config file /etc/spamassassin/v400.pre ...
root@satest-trixie:/var/cache/apt/archives# dpkg --configure spamd
Setting up spamd (4.0.1-4+salsaci+20250622+103) ...
root@satest-trixie:/var/cache/apt/archives# dpkg --configure   
root@satest-trixie:/var/cache/apt/archives# systemctl status spamd
● spamd.service - Perl-based spam filter using text analysis
     Loaded: loaded (/usr/lib/systemd/system/spamd.service; enabled; preset: 
enabled)
     Active: active (running) since Sun 2025-06-22 18:43:33 UTC; 10s ago
 Invocation: 9747f1b9d8d9406e99aa63eabe7a4633
   Main PID: 4768 (spamd)
      Tasks: 3 (limit: 4612)
     Memory: 133M (peak: 133.2M)
        CPU: 1.151s
     CGroup: /system.slice/spamd.service
             ├─4768 /usr/bin/perl "-T -w" /usr/sbin/spamd 
--pidfile=/run/spamd.pid --create-prefs --max-children 5 --helper->
             ├─4770 "spamd child"
             └─4771 "spamd child"

Jun 22 18:43:33 satest-trixie systemd[1]: Started spamd.service - Perl-based 
spam filter using text analysis.
Jun 22 18:43:33 satest-trixie spamd[4768]: zoom: able to use 408/408 'body_0' 
compiled rules (100%)
Jun 22 18:43:34 satest-trixie spamd[4768]: spamd: server started on 
IO::Socket::IP [::1]:783, IO::Socket::IP [127.0.0.1]:783>
Jun 22 18:43:34 satest-trixie spamd[4768]: spamd: server pid: 4768
Jun 22 18:43:34 satest-trixie spamd[4768]: spamd: server successfully spawned 
child process, pid 4770
Jun 22 18:43:34 satest-trixie spamd[4768]: spamd: server successfully spawned 
child process, pid 4771
Jun 22 18:43:34 satest-trixie spamd[4768]: prefork: child states: II
root@satest-trixie:/var/cache/apt/archives# dpkg --configure sa-compile
Setting up sa-compile (4.0.1-4+salsaci+20250622+103) ...
Running sa-compile (may take a long time)
Processing triggers for spamd (4.0.1-4+salsaci+20250622+103) ...
OK, restarting spamd due to trigger

### ^^^ Note trigger-based invocation of spamd.postinst here ^^^

root@satest-trixie:/var/cache/apt/archives# systemctl status spamd
● spamd.service - Perl-based spam filter using text analysis
     Loaded: loaded (/usr/lib/systemd/system/spamd.service; enabled; preset: 
enabled)
     Active: active (running) since Sun 2025-06-22 18:43:58 UTC; 22s ago
 Invocation: 5c29fa9a16a34dd2ae95079b67ca55ed
   Main PID: 5087 (spamd)
      Tasks: 3 (limit: 4612)
     Memory: 133M (peak: 133.2M)
        CPU: 1.150s
     CGroup: /system.slice/spamd.service
             ├─5087 /usr/bin/perl "-T -w" /usr/sbin/spamd 
--pidfile=/run/spamd.pid --create-prefs --max-children 5 --helper->
             ├─5089 "spamd child"
             └─5090 "spamd child"

Jun 22 18:43:58 satest-trixie systemd[1]: Started spamd.service - Perl-based 
spam filter using text analysis.
Jun 22 18:43:58 satest-trixie spamd[5087]: zoom: able to use 408/408 'body_0' 
compiled rules (100%)
Jun 22 18:43:59 satest-trixie spamd[5087]: spamd: server started on 
IO::Socket::IP [::1]:783, IO::Socket::IP [127.0.0.1]:783>
Jun 22 18:43:59 satest-trixie spamd[5087]: spamd: server pid: 5087
Jun 22 18:43:59 satest-trixie spamd[5087]: spamd: server successfully spawned 
child process, pid 5089
Jun 22 18:43:59 satest-trixie spamd[5087]: spamd: server successfully spawned 
child process, pid 5090
Jun 22 18:43:59 satest-trixie spamd[5087]: prefork: child states: IS
Jun 22 18:43:59 satest-trixie spamd[5087]: prefork: child states: II

Reply via email to