On Sun, 2014-06-01 at 01:21 +0200, Karsten Bräckelmann wrote: > I haven't really used systemd yet, but one fundamental design decision > is, that systemd itself takes care about sockets and stuff, returning > early and asynchronously lets the service complete starting up in the > background. > That could easily fit this scenario.
> This might explain what you are observing, the first spamc call failing, > if you do run spamc close after spamd service starting. Can you still > reproduce the issue, if you wait a minute before running spamc? > > Did you ever verify spamd was running, or did you just run your usual > test script? > Yep. Thats implied with a separate spamd start: sometimes I check that its running (script wrapper round 'systemctl status spamassassin') but you can tell from inspection because the testsa script takes a lot longer to run if it has to start spamd. > Also, IIRC you never mentioned the spamc exit code. See the man-page for > details, spamc differentiates between a lot of network and other error > conditions. > =========>Here's the instant 'start spamd, run spamc, stop spamd test: $ sudo systemctl start spamassassin; echo $?; echo | spamc; echo $?; sudo systemctl stop spamassassin 0 0 $ ===========>and here's the version with a delay after starting: $ sudo systemctl start spamassassin; echo $?; sleep 30 0 $ echo | spamc; echo $? 0 $ sudo systemctl stop spamassassin $ =============>same again but with 2 messages and no delay $ sudo systemctl start spamassassin; echo $?; spamc <x.txt; echo $?; spamc <x.txt; echo $?; sudo systemctl stop spamassassin 0 To: example.com body text. . 0 To: example.com body text. . 0 ================> as the last, but with a 2 sec delay between messages $ sudo systemctl start spamassassin; echo $?; spamc <x.txt; echo $?; sleep 2; spamc <x.txt; echo $?; sudo systemctl stop spamassassin 0 To: example.com body text. . 0 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on zappa.gregorie.lan X-Spam-Level: ***** X-Spam-Status: No, score=5.6 required=6.0 tests=MG_WRONG_DOMAIN,MISSING_DATE, MISSING_FROM,MISSING_MID,MISSING_SUBJECT,NO_RECEIVED,NO_RELAYS,TO_MALFORMED autolearn=no version=3.3.2 To: example.com body text. . 0 $ > For bonus-points, watch the logs for spamd claiming to be ready. > > Here you go: Jun 1 01:07:41 zappa spamd[15831]: plugin: eval failed: Insecure dependency in connect while running with -T switch at /usr/lib/perl5/IO/Socket.pm line 115. Jun 1 01:07:42 zappa spamd[15831]: spamd: server started on port 783/tcp (running version 3.3.2) Jun 1 01:07:42 zappa spamd[15831]: spamd: server pid: 15831 Jun 1 01:07:42 zappa spamd[15831]: spamd: server successfully spawned child process, pid 15832 Jun 1 01:07:42 zappa spamd[15831]: spamd: server successfully spawned child process, pid 15833 Jun 1 01:07:42 zappa spamd[15831]: prefork: child states: IS Jun 1 01:07:42 zappa spamd[15831]: prefork: child states: II Jun 1 01:07:42 zappa spamd[15832]: spamd: connection from zappa.gregorie.lan [127.0.0.1] at port 39842 Jun 1 01:07:42 zappa spamd[15832]: spamd: setuid to kiwi succeeded Jun 1 01:07:42 zappa spamd[15832]: spamd: Insecure dependency in connect while running setuid at /usr/lib/perl5/IO/Socket.pm line 115, <GEN9> line 9. Jun 1 01:07:42 zappa spamd[15831]: prefork: child states: II Jun 1 01:07:44 zappa spamd[15832]: spamd: connection from zappa.gregorie.lan [127.0.0.1] at port 39843 Jun 1 01:07:44 zappa spamd[15832]: spamd: setuid to kiwi succeeded Jun 1 01:07:44 zappa spamd[15832]: spamd: processing message (unknown) for kiwi:1000 Jun 1 01:07:44 zappa spamd[15832]: spamd: clean message (5.6/6.0) for kiwi:1000 in 0.1 seconds, 31 bytes. Jun 1 01:07:44 zappa spamd[15832]: spamd: result: . 5 - MG_WRONG_DOMAIN,MISSING_DATE,MISSING_FROM,MISSING_MID,MISSING_SUBJECT,NO_RECEIVED,NO_RELAYS,TO_MALFORMED scantime=0.1,size=31,user=kiwi,uid=1000,required_score=6.0,rhost=zappa.gregorie.lan,raddr=127.0.0.1,rport=39843,mid=(unknown),autolearn=no Jun 1 01:07:44 zappa spamd[15831]: spamd: server killed by SIGTERM, shutting down I think the 2nd 'insecure dependency' at 01:07:42 is associated with spamd receiving the first message Martin