[Home]

Summary:ASTERISK-13585: ODBC-based function crashes Asterisk
Reporter:Laurent Steffan (lmsteffan)Labels:
Date Opened:2009-02-16 00:01:31.000-0600Date Closed:2011-06-07 14:00:24
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Functions/func_odbc
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) func_odbc.conf
( 1) gdb.txt
( 2) malloc_debug.txt
( 3) res_odbc.conf
( 4) valgrind.txt
Description:I have defined a simple function in func_odbc.conf to read (SELECT) one value from MySQL database. It works the first time, and crashes very soon after, sometimes as soon as the next invocation.

The CLI command that I use is "odbc read MY_FUNCTION arg1 exec".
Comments:By: Tilghman Lesher (tilghman) 2009-02-16 10:39:58.000-0600

Please upload your func_odbc.conf and your res_odbc.conf.

By: Tilghman Lesher (tilghman) 2009-02-16 18:03:33.000-0600

I need the following output from gdb:

frame 8
p *obj

By: Tilghman Lesher (tilghman) 2009-02-16 18:05:51.000-0600

If parent within that structure is NULL or points to an unaddressable byte, e.g. the output of "p *(obj->parent)", then I'll need you to follow the instructions in doc/valgrind.txt.

By: Laurent Steffan (lmsteffan) 2009-02-16 22:40:29.000-0600

The address pointed to by "p *(obj->parent)" is indeed 0. I'll send you the output given by valgrind shortly.

By: Tilghman Lesher (tilghman) 2009-02-18 17:33:13.000-0600

Could you try current trunk?  I believe this has been fixed with the changes from another issue.

By: Laurent Steffan (lmsteffan) 2009-02-18 23:22:13.000-0600

Well it does not crash any more. However I no longer have access to the database:

- for the query that had a problem:

*CLI> odbc read FILTRAGE_INFO 6210 exec
Failed to execute query. [SELECT filtre_par FROM ast_sipfriends WHERE name=6210]

- but also the registrations do not work any more:

[Feb 19 16:18:08] ERROR[10368]: res_config_odbc.c:144 realtime_odbc: No database handle available with the name of 'asterisk' (check res_odbc.conf)

By: Tilghman Lesher (tilghman) 2009-02-19 13:21:42.000-0600

Works for me:

res_odbc.conf:
[asterisk]
enabled => yes
dsn => mysql-asterisk
username => root
;password => mypass
pre-connect => yes
idlecheck => 3600
share_connections => no
limit => 3


*CLI> odbc read ODBC_SIPPEERS vidphone exec
fullcontact           sip:vidphone@192.168.69.71:506
useragent             Grandstream GXV3000 1.1.3.8
Returned 1 row.  Query executed on handle 0 [asterisk]
      > Saved useragent "Grandstream GXV3000 1.1.3.8" for peer vidphone
*CLI> core show function ODBC_SIPPEERS

 -= Info about function 'ODBC_SIPPEERS' =-

[Synopsis]
Runs the referenced query with the specified arguments

[Description]
Runs the following query, as defined in func_odbc.conf, performing
substitution of the arguments into the query as specified by ${ARG1},
${ARG2}, ... ${ARGn}.  This function may only be read, not set.

SQL:
SELECT fullcontact,useragent FROM sipfriends WHERE name='${ARG1}'


[Syntax]
ODBC_SIPPEERS(<arg1>[...[,<argN>]])

[Arguments]
Not available

[See Also]
Not available
*CLI>

By: Tilghman Lesher (tilghman) 2009-03-02 10:43:37.000-0600

No response from reporter.