On Sat, 2014-05-31 at 23:07 +0100, Martin Gregorie wrote: > On Sat, 2014-05-31 at 20:15 +0200, Karsten Bräckelmann wrote:
> > > The testsa script looks like this: > > > > > state=$(spamdstatus) > > > if [ "$state" == 'spamd is stopped' ] > > > then > > > sudo systemctl start spamassassin.service > > > fi > > > > Most likely unrelated, though this code might potentially mess with > > spamd unnoticed. I'd get rid of that part while debugging the issue, or > > at least make it clearly print a warning. > > This script looks like this: > So I don't see how it can mess with spamd. By "messing with" I mean code that potentially (re)starts spamd, without us knowing. That is an absolute no-go when debugging or tracking down bugs. > In any case the first time > failure happens regardless of whether testsa is allowed to start and > stop spamd of it it is started separately. The only difference is that > if testsa does the start/stop it always fails since every test it > submits is the first spamc request after a restart, while if spamd is > started separately, only the first test fails to scan the message: the > rest are OK until spamd is stopped and restarted. Actually, thinking about that (re)starting of spamd, and only the first attempt failing: 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. 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? 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. Generally, while debugging $product issues, you should first get complex custom wrappers out of the equation. With spamc, a stripped down test case is: echo | spamc echo $? No complex wrapper, no spam needed. Generate minimal input. There will always be at least an X-Spam-Version header, if it passed spamd. Get the exit code in case of failure (no X-Spam header), compare with the man-page. Run once *immediately* after starting spamd as usual. Stop and restart spamd as usual, wait, and try stripped down test case again. For bonus-points, watch the logs for spamd claiming to be ready. -- char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4"; main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1: (c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}