# dspam: exited on signal 11 (core dumped)



## cbrace (Apr 30, 2013)

Hi all,

Trying to fix a small problem elsewhere, I inadvertently broke my mail/dspam installation. dspam is now dying about once an hour, and I see lines like this in /var/log/maillog:

```
status=deferred (lost connection with myhost [/var/run/dspam.sock] while performing the LHLO handshake)
```
I have debugging switched on, but /var/log/dspam/dspam.debug isn't telling me anything. In `dmesg`, however, I repeatedly see lines like this:

```
pid 7038 (dspam), uid 0: exited on signal 11 (core dumped)
```
dspam appears to be running OK; it is filtering messages and writing to its logs and data files (/var/db/dspam/data), but is sporadically dying. Any suggestions for how to determine why this is happening?


----------



## cpm@ (Apr 30, 2013)

Reinstall dspam with WITH_DEBUG flag. Use gdb(1) to print a complete backtrace. IIRC core dumps with signal core 11 are RAM problems.
`# cd /usr/ports/mail/dspam && make WITH_DEBUG=yes install clean`

Submit a PR to freebsd-currents@ ML providing the output.


----------



## cbrace (Apr 30, 2013)

Thanks. This is what I now see in `gdb`:


```
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 801408800 (LWP 146330/dspam)]
0x00000008011e93fa in _hash_drv_seek (map=0x8014be200, offset=0, hashcode=3254489448401649664, flags=0) at hash_drv.c:1193
1193	hash_drv.c: No such file or directory.
	in hash_drv.c
```


----------



## cbrace (Apr 30, 2013)

From this thread on the dspam-users list, it appears that the hash file (.css) may be corrupt.


----------



## cbrace (Apr 30, 2013)

Running `# cssclean [email=/var/db/dspam/data/user@domain.tld]/var/db/dspam/data/user@domain.tld[/email]/user@domain.tld.css` seems to have fixed it... I think.


----------



## cpm@ (May 1, 2013)

Check out http://sourceforge.net/mailarchive/forum.php?thread_name=20101113164447.9e37dabc.stevan%40bajic.ch&forum_name=dspam-devel.


----------



## cbrace (May 1, 2013)

No more segfaults; if the hash file was corrupt, it is no longer. Not sure what was going on there; I run cssclean in a nightly cronjob; it wasn't like it was the first time I used that command.

I thought this might be a useful opportunity to migrate to the MySQL driver. dspam includes a command for importing tokens from the hash file format into MySQL: `# dspam_2sql | mysql -D dspam -u dspam -p`
But alas it throws up a lot of errors like this:

```
Unable to obtain uid for user cb@domain.TLD
```
That makes sense, no, these would all be virtual users. But I can't find any documentation explaining how this is supposed to work.


----------



## cpm@ (May 1, 2013)

Seems that dspam_2sql doesn't work with virtual users, I found this patch which fix this inconvenience.

Reference: http://www.shapeshifter.se/2009/03/03/dspam-converting-from-the-hash-driver-to-mysql-driver/.


----------



## cbrace (May 2, 2013)

Thanks, I had already seen that page. Problem is, that patch is for v3.8. The oldest version I can find on SF is v3.9

If one knows what they are doing (which I don't), perhaps one could _patch the patch file_, but this is getting  above my head:
	
	



```
--- dspam-3.8.0.orig/src/tools/dspam_2sql.c	2006-05-13 03:13:01.000000000 +0200
+++ dspam-3.8.0/src/tools/dspam_2sql.c	2009-03-03 18:12:45.000000000 +0100
@@ -25,6 +25,7 @@
[...]
```


----------



## cpm@ (May 2, 2013)

Use diff(1) to compare dspam_2sql.c files and see if differ much.


----------



## cbrace (May 2, 2013)

Not sure I follow you. I don't have access to dspam-3.8.0/src/tools/dspam_2sql.c


----------



## cpm@ (May 2, 2013)

cbrace said:
			
		

> Not sure I follow you. I don't have access to dspam-3.8.0/src/tools/dspam_2sql.c



`# diff -u dspam_2sql.c.orig dspam_2sql.c > dspam_2sql.c.diff`

```
--- dspam_2sql.c.orig   2006-05-13 03:13:01.000000000 +0200
+++ dspam_2sql.c        2013-05-02 13:44:02.000000000 +0200
@@ -2,7 +2,7 @@
 
 /*
  DSPAM
- COPYRIGHT (C) 2002-2006 JONATHAN A. ZDZIARSKI
+ COPYRIGHT (C) 2002-2009 DSPAM PROJECT
```

Apply patch is safe:


```
# cd /usr/ports/mail/dspam/work/dspam-3.9.0/src/tools
# fetch http://www.shapeshifter.se/wp-content/uploads/2009/03/dspam_2sql_virtuser.patch
# patch -p0 < dspam_2sql_virtuser.patch
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- dspam-3.8.0.orig/src/tools/dspam_2sql.c	2006-05-13 03:13:01.000000000 +0200
|+++ dspam-3.8.0/src/tools/dspam_2sql.c	2009-03-03 18:12:45.000000000 +0100
--------------------------
File to patch: dspam_2sql.c
Patching file dspam_2sql.c using Plan A...
Hunk #1 succeeded at 25.
Hunk #2 succeeded at 44.
Hunk #3 succeeded at 59.
Hunk #4 succeeded at 77.
Hunk #5 succeeded at 89.
Hunk #6 succeeded at 100.
Hunk #7 succeeded at 117.
Hunk #8 succeeded at 157.
Hunk #9 succeeded at 167.
Hunk #10 succeeded at 204.
Hunk #11 succeeded at 213.
done
```

Rebuild mail/dspam port.


----------

