Summary:ASTERISK-07354: Asterisk killed by SIGSEGV when accessing existing database record.
Reporter:Irving Barr (irving_wp)Labels:
Date Opened:2006-07-18 10:11:17Date Closed:2011-06-07 14:00:48
Versions:Frequency of
Environment:Attachments:( 0) bt_full_output_anthony_procedure.txt
( 1) bt_on_core_file_voip_wiki_procedure.txt
( 2) making_asterisk_crash.txt
( 3) safe_asterisk_output_when_crashing.txt
Description:When using realtime, each time Asterisk performs a query for a record in a database which actually exists, it stops working.
The output of strace shows +++ killed by SIGSEGV +++.


If I force a query for a record that does not exist, issueing a "realtime load <family> <row-to-match> <value>", Asterisk successfully reports "No rows found matching search criteria". That suggest that the problem is when it does get a match.
The database is MySQL 5.0.22, addons package version 1.2.3
Comments:By: Irving Barr (irving_wp) 2006-07-18 10:16:17

Please feel free to tell me if you need more information. I know a simple CLI is not too much, but I didn't want to crowd this report with a lot of files such as the full strace output.

By: Anthony LaMantia (alamantia) 2006-07-18 10:50:43

do you have a backtrace? ..  

you can run asterisk like this

gdb asterisk


r -cvvvvvv

after this do what you did to cause the service to crash

type bt and copy and paste to this report the data there.


By: Serge Vecher (serge-v) 2006-07-18 11:16:05

can you please produce a backtrace of a core dumped when Asterisk crashes? It needs to be built with 'make dont-optimize' also.

See this section if you need to know how to produce a bt.

By: Irving Barr (irving_wp) 2006-07-18 13:42:59

Thanks guys...
I have already uploaded the requested files. Asterisk was recompiled and reinstalled without optimizations.

By: Anthony LaMantia (alamantia) 2006-07-19 10:06:27

is there anyway from the gdb method i posted to you above you can paste the a the contents of the stack..

x/30x $esp  
x/30x $ebp

and maybe x/20i $eip-15

i trying to pinpoint what the iration of the loop is and what the numFields variables are/were
when you are making the call to ast_variable_new(fields[i].name...


By: Anthony LaMantia (alamantia) 2006-07-19 13:48:22

this is really dieing when strlen() is being challed with the unchecked name and value points from ast_variable_new()

maybe we can replace this with ast_strlen_zero() or do some checking on ast_variable_new..

the most likley way to fix thing is to do it via the res_mysql code which i will start working on a patch for shortly unless anyone else posts one first.

By: Tilghman Lesher (tilghman) 2006-08-05 09:24:31

This appears to be a bug in MySQL, or a possible result of incompatible libraries and headers installed on the system.  Please see:


By: Matt O'Gorman (mogorman) 2006-08-18 17:05:01

irving_wp have you seen this?

By: Irving Barr (irving_wp) 2006-08-19 11:52:15

Yes, I have.
I'm using MySQL 5.0.22 standard, but the precompiled version, so that I think that the advice given in the previous link does not work for me. I run MySQL from the folder /usr/local/mysql so I guess it uses the include and lib folders in there.
Since I wouldn't lose anything giving it a try, I actually renamed the /usr/include/mysql to /usr/include/mysql-3.23 and /usr/lib/mysql to /usr/lib/mysql-3.23 and restarted the service. MySQL runs fine but Asterisk keeps crashing.

By: Irving Barr (irving_wp) 2006-08-19 12:19:06

sorry for my delayed response

By: Anthony LaMantia (alamantia) 2006-09-07 15:33:20

Hi, I am devloping a small patch that you can use now... but for me to be able to find the actual error it would be super helpfull if you could build your copy of asterisk addons, with debugging symbols and then provide that backtrace..

there are a few call to ast_variable_new() from the mysql code inside of asterisk and to find the specific one that us causing you(any maybe others) problems im going to need to figure out which one it is....

By: Irving Barr (irving_wp) 2006-09-07 15:53:54

Anthony, thank you very much...
please tell me what to do, I'm ready to provide whatever you need but I'm not too clear about the procedure

By: Anthony LaMantia (alamantia) 2006-09-07 16:21:57

well the easiest way that i know of to compile something with debuggin symbols would just to be go to the asterisk-addons source directory

open the makefile in vi or which ever text editor you are at home with and
add  the line

CFLAGS +=-ggdb

and then rebuild.. then just follow the previous insturctions on generating a backtrace and it should be good.

By: Irving Barr (irving_wp) 2006-09-07 17:09:05

I added this line in the Makefile


And when loading asterisk, I get this messages:

[res_config_mysql.so]Sep  7 17:04:39 WARNING[21873]: loader.c:325 __load_resource: /usr/lib/asterisk/modules/res_config_mysql.so: undefined symbol: __pure_virtual
Sep  7 17:04:39 WARNING[21873]: loader.c:499 load_modules: Loading module res_config_mysql.so failed!

And asterisk stops loading.
Is there another way to get debugging symbols? What am I doing wrong?

By: Irving Barr (irving_wp) 2006-09-08 11:19:09

OK, everything is fine now...   it seems that my installation of mysql was wrong from the beginning. I realized after the last error message (see previous note).

I had libraries from mysql-3.28 and was running the server 5.0.22. What a mess.
I removed all previous RPMs of mysql and compiled the source from the scratch.
Asterisk is not killed by SIGSEGV anymore.

Thank you very much for your help.