# Cannot start spamd - segfaults

## nitro322

Hello.  I have a cron job that runs at 06:00 each morning to update spamassasin's rules and restart spamd.  Very basic:

However, spamd did not successfully restart this morning.  When I try to manually start it, I get a segfault.  So far I've tried:

1. Re-running sa-update - same segfault

2. Deleting /var/lib/spamassassin/3.004001 - won't run without an initial update

3. Running sa-update after the delete - same segfault

4. Re-emerging spamassassin - same segfault

4. Updating from 3.4.1-r20 ~3.4.1-r21 - same segfault

I did update a few packages yesterday (since the previous spamd restart), but none appear to be related to spamassassin:

apache-tools, apache, acpid, keyutils, iotop, imagemagick, clamav, udev, lvm2, mysql-connector, mariadb, eselect-php, php, pecl-apcu

Logs don't show anything helpful.  Manually running spamd and tacking on -D does show some output, but nothing that really points me to the cause.  I'm including that below.

Any ideas what could be causing this, or how to troubleshoot further?  I was thinking this may be related to a corrupt update or something from sa-update, but I can't figure out how to install an older update or revert yesterday's changes, nor do I have a backup of that directory.

Spam's already getting out of control in my inbox, so I'd definitely appreciate any pointers.   :Smile:   Thanks.

Edit: I don't seem to be able to include the full output from spamd -D, so I've placed a copy for review here.

----------

## John R. Graham

I don't see anything particularly interesting in that log either. You might want to try running strace on your spamd invocation command line to see what it's doing when it segfaults. Something like

```
strace -o strace-log.txt {insert_your_spamd_command_line_here}
```

This may point you to a particular library, at which point you could try rebuilding the package that provides the library.

- John

----------

## nitro322

Thanks for the response.  Tried strace, but that doesn't seem to provide any clues, either.  Here's the tail end of the output, starting from the last line output in the spamd.log file I shared earlier for context:

```
write(4, "<23>Aug 10 10:29:07 spamd[20687]: plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x556f939a9140) implements 'learner_close', priority 0\n\0", 137) = 137

rt_sigprocmask(SIG_BLOCK, [PIPE], [], 8) = 0

rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fefd3e890e0}, {sa_handler=0x7fefd42d1fc0, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fefd3e890e0}, 8) = 0

rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0

rt_sigprocmask(SIG_BLOCK, [PIPE], [], 8) = 0

rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fefd3e890e0}, {sa_handler=SIG_IGN, sa_mask=[], sa_flags=SA_RESTORER, sa_restorer=0x7fefd3e890e0}, 8) = 0

rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0

sendto(9, "\1\0\0\0\1", 5, 0, NULL, 0)  = 5

shutdown(9, SHUT_RDWR)                  = 0

close(9)                                = 0

--- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x6f945fb348} ---

+++ killed by SIGSEGV +++
```

Don't see anything helpful there, but this is getting pretty deep for me.  Anything set off any red flags for you?

----------

## freke

I recently had to restart my mail-server which uses amavisd-new which again uses spamassassin.

I couldn't get spamassassin to start, turned out to be both Bayes and AWL/TxREP that caused trouble and I ended up disabling those in the *.pre-files (I notice that your last line is Bayes) - neither my current working SQL-configuration nor when disabling it worked out.

If it's becuase of an MariaDB-update or what's causing it I don't know (though I couldn't really get Bayes to work in nonSQL-config either)

AWL/TxREP I could just disable SQL-configuration and get to work with plain BerkDB

----------

## nitro322

Huh.  Thanks for the suggestion, freke.  Disabling this line does get it starting up again:

#loadplugin Mail::SpamAssassin::Plugin::Bayes

Not ideal, obviously, but at least gets the basics covered.  I did re-emerge mariadb yesterday, but it was just updating some use flags (as a result of emerge -DNa @world).  Can't think what would've changed there, but I'll dig in and report back.

Of course, I've also been thinking about revamping my spam controls and tentatively moving to rspam instead of spamassassin.  Might be a good excuse to seriously look into that.

Anyway, thank you both.  Much appreciated.

----------

## freke

Well thanks, too - didn't know about rspamd - think I'll have a look into that  :Smile: 

----------

## Hu

What does the backtrace implicate?  That may let you narrow down how the plugin breaks it, and potentially offer a way to use part of the plugin.  Having the backtrace could also be useful in getting upstream to fix the crash.

----------

## shiznix

Don't forget to also check your perl installation is clean and all your installed perl modules are sitting on the same version.

```
ls /usr/lib/perl5/vendor_perl
```

Spamd is simply a Perl script and is susceptible to segfaulting if perl module version mismatches occur, so to fix:

```
perl-cleaner --reallyall
```

----------

## siulian

I know the topic is old but i think this might help others who are having the same issues.

Most probably this happened after you update the mysql/mariadb.

You need to recompile dev-perl/DBD-mysql

----------

