[Asterisk-Dev] realtime 1.5 seg fault

George Konstantoulakis gkon at inaccessnetworks.com
Thu Jan 27 10:34:07 MST 2005


Hello Mathew ,
first let me say that I like your work on res_config_mysql
very much!
I did a stress test today with 40.000 rows in my SIP table
and it works like a charm.
I encounterded a problem when I try to get data
via realtime-mysql  from the extensions table.
When realtime tries to retrieve  an extension  that starts with  _
asterisk seg-faults ...
It works ok when the extension doesn't contain _ .

using :
---------

*CLI> show version
Asterisk CVS-HEAD-01/27/05-12:15:41 built by
gkon at lothlorien.priv.inaccessnetworks.com on a i686 running Linux


backtrace :
-------------

#0  ast_variable_append (category=0x0, variable=0x810d070) at config.c:128
128             if (category->last)
(gdb) bt
#0  ast_variable_append (category=0x0, variable=0x810d070) at config.c:128
#1  0x42382374 in _init () from
/home/gkon/slash/usr/lib/asterisk/modules/res_config_mysql.so
#2  0x080599d1 in ast_load_realtime_multientry (family=0x810d070
"\220Ð\020\b\223Ð\020\b") at config.c:845
#3  0x45cbd744 in realtime_switch_common (table=0x426b4b71 "extensions",
context=0x8167880 "real-test",
    exten=0x426bb150 "112", priority=135319664, mode=0) at
pbx_realtime.c:115
#4  0x45cbcfbd in realtime_exists (chan=0x0, context=0x8167880 "real-test",
    exten=0x810d070 "\220Ð\020\b\223Ð\020\b", priority=135319664,
callerid=0x426bb058 "205",
    data=0x426b470c "SELECT * FROM extensions WHERE exten LIKE '\\_%'
AND context = 'real-test' AND priority = '1' ORDER BY exten") at
pbx_realtime.c:145
#5  0x08079834 in pbx_find_extension (chan=0x0, bypass=0x0,
context=0x8167880 "real-test",
    exten=0x426bb150 "112", priority=1, label=0x0, callerid=0x426bb058
"205", action=0, incstack=0x426badbc,
    stacklen=0x426b4c48, status=0x426b4c4c, swo=0x426b4c50,
data=0x426b4c54, foundcontext=0x426b4c58)
    at pbx.c:774
#6  0x08082bc6 in pbx_extension_helper (c=0x0, con=0x810d070,
context=0x8167880 "real-test",
    exten=0x426bb150 "112", priority=1, label=0x0, callerid=0x426bb058
"205", action=0) at pbx.c:1241
#7  0x080815f5 in ast_exists_extension (c=0x810d070, context=0x810d070
"\220Ð\020\b\223Ð\020\b",
    exten=0x810d070 "\220Ð\020\b\223Ð\020\b", priority=135319664,
callerid=0x810d070 "\220Ð\020\b\223Ð\020\b")
    at pbx.c:1810
#8  0x424b1b2f in get_destination (p=0x81673c0, oreq=0x0) at chan_sip.c:5183
#9  0x424abb79 in handle_request (p=0x81673c0, req=0x426c477c,
sin=0x426c476c, recount=0x810d070,
    nounlock=0x426c4704) at chan_sip.c:7708
#10 0x424a858e in sipsock_read (id=0x8137a40, fd=11, events=1,
ignore=0x0) at chan_sip.c:8163
#11 0x08053070 in ast_io_wait (ioc=0x81352c0, howlong=135319664) at io.c:267
#12 0x424a26b4 in do_monitor (data=0x0) at chan_sip.c:8310




asterisk CLI :
-----------------
(I tried to call extension 112 )


*CLI>
*CLI> Jan 27 16:43:24 DEBUG[12771]: chan_sip.c:2337 sip_alloc:
Allocating new SIP call for b12d09d092b6a918 at 192.168.1.205
Jan 27 16:43:24 DEBUG[12771]: res_config_mysql.c:112 realtime_mysql:
MySQL RealTime: Retrieve SQL: SELECT * FROM sip WHERE name = '205'
Jan 27 16:43:24 DEBUG[12771]: res_config_mysql.c:595 mysql_reconnect:
MySQL RealTime: Everything is fine.
Jan 27 16:43:24 DEBUG[12771]: chan_sip.c:5593 check_user_full: Setting
NAT on RTP to 0
Jan 27 16:43:24 DEBUG[12771]: chan_sip.c:7698 handle_request: Check for
res for 205
Jan 27 16:43:24 DEBUG[12771]: res_config_mysql.c:112 realtime_mysql:
MySQL RealTime: Retrieve SQL: SELECT * FROM sip WHERE name = '205'
Jan 27 16:43:24 DEBUG[12771]: res_config_mysql.c:595 mysql_reconnect:
MySQL RealTime: Everything is fine.
Jan 27 16:43:24 DEBUG[12771]: chan_sip.c:1576 update_user_counter: Call
from user '205' is 1 out of 0
Jan 27 16:43:24 DEBUG[12771]: res_config_mysql.c:112 realtime_mysql:
MySQL RealTime: Retrieve SQL: SELECT * FROM extensions WHERE exten =
'112' AND context = 'real-test' AND priority = '1'
Jan 27 16:43:24 DEBUG[12771]: res_config_mysql.c:595 mysql_reconnect:
MySQL RealTime: Everything is fine.
Jan 27 16:43:24 DEBUG[12771]: res_config_mysql.c:223
realtime_multi_mysql: MySQL RealTime: Retrieve SQL: SELECT
* FROM extensions WHERE exten LIKE '\_%' AND context = 'real-test' AND
priority = '1' ORDER BY exten
Jan 27 16:43:24 DEBUG[12771]: res_config_mysql.c:595 mysql_reconnect:
MySQL RealTime: Everything is fine.
Segmentation fault
[gkon at lothlorien sbin]$



extensions table :
----------------------

+----+-----------+-------+----------+--------+--------------------+
| id  | context   | exten | priority | app   | appdata              |
+----+-----------+-------+----------+--------+---------------------+
|  1 | real-test | _11X  |        1 | NoOp     |
   |
|  2 | real-test | _11X  |        2 | Answer  |                            |
|  3 | real-test | _11X  |        3 | Echo
|                            ||
|  4 | real-test | _22X  |        1 | DIAL     | SIP/${EXTEN} |
+----+-----------+-------+----------+--------+----------------------+


extconfig.conf
--------------------
.......
sipfriends => mysql,asterisk,sip
extensions => mysql,asterisk,extensions
.......

extensions.conf
--------------------
................
[real-test]
switch => Realtime/@extensions
.......................

res_mysql.conf
----------------------

[general]
dbuser=root
dbpass=
dbhost=localhost
dbname=asterisk
dbsock=/var/lib/mysql/mysql.sock







More information about the asterisk-dev mailing list