[Home]

Summary:ASTERISK-06762: ODBC crashes whenever I issue any valid ODBC-related command...
Reporter:Leo Burd (leoburd)Labels:
Date Opened:2006-04-12 06:32:01Date Closed:2011-06-07 14:00:35
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Applications/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) backtrace.txt
( 1) backtrace2.txt
( 2) gdb_output.txt
Description:Hello there,

For some reason, Asterisk is crashing everytime that my system tries to do
anything related to ODBC.  

Here's what I've found out so far:

* I can run "isql -v asterisk asterisk_user asterisk_user" without any problems

* When asterisk is started, it opens the odbc connection with the database.  I can see that with ODBCConfig's stats monitor

*  if I write an invalid username or password in res_odbc.conf, Asterisk detects the error and reports an appropriate message whenever I issue a "odbc connect asterisk"

* Asterisk crashes everytime it has to do a ODBC operation and the entries in res_odbc.conf are correct.  That happens if I write "odbc show", "odbc connect asterisk", "odbc disconnect asterisk" on CLI.  That also happens when my dialplan calls VoiceMailMain or VoiceMail (which are configured to use ODBC)

Below I've pasted my different configuration files and logs.

I'm running Asterisk 1.2.6 on a Red Hat Linux Enterprise 4 machine...

Please let me know if you need further information

Thanks in advance,

Leo

****** ADDITIONAL INFORMATION ******

------------------------------------------------------------------------------
Here's my extconfig.conf:

;example => odbc,asterisk,alttable
;iaxusers => odbc,asterisk
;iaxpeers => odbc,asterisk
;sipusers => odbc,asterisk
;sippeers => odbc,asterisk
voicemail => odbc,asterisk,voicemail_users  
extensions => odbc,asterisk,extensions

-------------------------------------------------------------------------
Here's my res_odbc.conf file:

;;; odbc setup file

[asterisk]              ; identifier (may have to have the same name as the dsn)
dsn => asterisk         ; database name
username => asterisk_user
password => asterisk_user
pre-connect => yes

--------------------------------------------------------------------------------
Here's the Asterisk log for the last attempts that I tried to use the system

Apr 12 06:57:32 DEBUG[9271] chan_sip.c: Scheduled a registration timeout for proxy01.sipphone.com id  ASTERISK-1
Apr 12 06:57:32 DEBUG[9271] chan_sip.c: Stopping retransmission on '0df0bb7e02c4aa995f6fd342536de1db@18.85.1.21' of Request 102: Match Found
Apr 12 06:57:32 DEBUG[9271] chan_sip.c: Scheduled a registration timeout for fwd.pulver.com id  ASTERISK-4
Apr 12 06:57:32 DEBUG[9271] chan_sip.c: Stopping retransmission on '7ac0f6e808b1b2660b765cff6ae63041@18.85.1.21' of Request 102: Match Found
Apr 12 06:57:32 DEBUG[9271] chan_sip.c: Stopping retransmission on '7ac0f6e808b1b2660b765cff6ae63041@18.85.1.21' of Request 103: Match Found
Apr 12 06:57:32 DEBUG[9271] chan_sip.c: Registration successful
Apr 12 06:57:32 DEBUG[9271] chan_sip.c: Cancelling timeout 8
Apr 12 06:57:33 DEBUG[9271] chan_sip.c: Stopping retransmission on '0df0bb7e02c4aa995f6fd342536de1db@18.85.1.21' of Request 103: Match Found
Apr 12 06:57:33 DEBUG[9271] chan_sip.c: Registration successful
Apr 12 06:57:33 DEBUG[9271] chan_sip.c: Cancelling timeout 5
Apr 12 06:58:01 DEBUG[9271] chan_sip.c: Auto destroying call '36C09C33A1924284A37045ECED582982@18.85.1.21'
Apr 12 06:58:04 DEBUG[9271] chan_sip.c: Auto destroying call '7ac0f6e808b1b2660b765cff6ae63041@18.85.1.21'
Apr 12 06:58:05 DEBUG[9271] chan_sip.c: Auto destroying call '0df0bb7e02c4aa995f6fd342536de1db@18.85.1.21'
Apr 12 07:03:25 DEBUG[9365] res_config_mysql.c: MySQL RealTime Host: localhost
Apr 12 07:03:25 DEBUG[9365] res_config_mysql.c: MySQL RealTime Port: 3306
Apr 12 07:03:25 DEBUG[9365] res_config_mysql.c: MySQL RealTime User: asterisk_user
Apr 12 07:03:25 DEBUG[9365] res_config_mysql.c: MySQL RealTime Password: asterisk_user
Apr 12 07:03:25 DEBUG[9365] res_config_mysql.c: MySQL RealTime: Successfully connected to database.
Apr 12 07:03:25 DEBUG[9365] pbx_dundi.c: Seeding global EID '00:b0:d0:ab:9b:1a' from 'eth0'
Apr 12 07:03:25 DEBUG[9365] db.c: Unable to find key 'diax' in family 'IAX/Registry'
Apr 12 07:03:25 DEBUG[9365] db.c: Unable to find key 'wmn' in family 'SIP/Registry'
Apr 12 07:03:25 DEBUG[9365] app_voicemail.c: VM Operator break disabled globally
Apr 12 07:03:25 DEBUG[9365] app_voicemail.c: VM CID Info before msg disabled globally
Apr 12 07:03:25 DEBUG[9365] app_voicemail.c: Send Voicemail msg disabled globally
Apr 12 07:03:25 DEBUG[9365] app_voicemail.c: Duration info before msg enabled globally
Apr 12 07:03:25 DEBUG[9365] app_voicemail.c: We are not going to skip to the next msg after save/delete
Apr 12 07:03:25 DEBUG[9365] cdr_addon_mysql.c: cdr_mysql: got hostname of localhost
Apr 12 07:03:25 DEBUG[9365] cdr_addon_mysql.c: cdr_mysql: got port of 0
Apr 12 07:03:25 DEBUG[9365] cdr_addon_mysql.c: cdr_mysql: got a timeout of 0
Apr 12 07:03:25 DEBUG[9365] cdr_addon_mysql.c: cdr_mysql: got user of asterisk_user
Apr 12 07:03:25 DEBUG[9365] cdr_addon_mysql.c: cdr_mysql: got dbname of asterisk
Apr 12 07:03:25 DEBUG[9365] cdr_addon_mysql.c: cdr_mysql: got password of asterisk_user
Apr 12 07:03:25 DEBUG[9365] cdr_addon_mysql.c: Successfully connected to MySQL database.
Apr 12 07:03:25 DEBUG[9385] chan_sip.c: Scheduled a registration timeout for proxy01.sipphone.com id  ASTERISK-1
Apr 12 07:03:25 DEBUG[9385] chan_sip.c: Stopping retransmission on '4a91433f7ea1c3050a8ce84f6eaa6331@18.85.1.21' of Request 102: Match Found
Apr 12 07:03:25 DEBUG[9385] chan_sip.c: Scheduled a registration timeout for fwd.pulver.com id  ASTERISK-4
Apr 12 07:03:25 DEBUG[9385] chan_sip.c: Stopping retransmission on '7485f8c03f173bff3db8ff044845e754@18.85.1.21' of Request 102: Match Found
Apr 12 07:03:25 DEBUG[9385] chan_sip.c: Stopping retransmission on '7485f8c03f173bff3db8ff044845e754@18.85.1.21' of Request 103: Match Found
Apr 12 07:03:25 DEBUG[9385] chan_sip.c: Registration successful
Apr 12 07:03:25 DEBUG[9385] chan_sip.c: Cancelling timeout 8
Apr 12 07:03:25 DEBUG[9385] chan_sip.c: Stopping retransmission on '4a91433f7ea1c3050a8ce84f6eaa6331@18.85.1.21' of Request 103: Match Found
Apr 12 07:03:25 DEBUG[9385] chan_sip.c: Registration successful
Apr 12 07:03:25 DEBUG[9385] chan_sip.c: Cancelling timeout 5
Apr 12 07:03:50 DEBUG[9385] chan_sip.c: Auto destroying call '36C09C33A1924284A37045ECED582982@18.85.1.21'
Apr 12 07:03:57 DEBUG[9385] chan_sip.c: Auto destroying call '7485f8c03f173bff3db8ff044845e754@18.85.1.21'
Apr 12 07:03:57 DEBUG[9385] chan_sip.c: Auto destroying call '4a91433f7ea1c3050a8ce84f6eaa6331@18.85.1.21'
Apr 12 07:04:12 DEBUG[9385] chan_sip.c: Setting NAT on RTP to 0
Apr 12 07:04:12 DEBUG[9385] chan_sip.c: Checking SIP call limits for device 17476477022
Apr 12 07:04:12 DEBUG[9385] chan_sip.c: build_route: Record-Route hop: <sip:whats_up@198.65.166.131;ftag=df275e12;lr=on>
Apr 12 07:04:13 DEBUG[9402] chan_sip.c: Oooh, format changed to 1024
Apr 12 07:04:13 DEBUG[9385] chan_sip.c: Stopping retransmission on 'e27a732b8d7ac14a@TExLLVQ0MC5tZWRpYS5taXQuZWR1' of Response 1: Match Found
Apr 12 07:04:21 DEBUG[9402] pbx.c: Oooh, got something to jump out with ('1')!

--------------------------------------------------------------------------------
Here's the odbc trace log generated after a session in which VoiceMailMain was called:

[ODBC][9365][__handles.c][444]
               Exit:[SQL_SUCCESS]
                       Environment = 0x87b5d58
[ODBC][9365][SQLSetEnvAttr.c][182]
               Entry:
                       Environment = 0x87b5d58
                       Attribute = SQL_ATTR_ODBC_VERSION
                       Value = 0x3
                       StrLen = 0
[ODBC][9365][SQLSetEnvAttr.c][349]
               Exit:[SQL_SUCCESS]
[ODBC][9365][SQLAllocHandle.c][345]
               Entry:
                       Handle Type = 2
                       Input Handle = 0x87b5d58
[ODBC][9365][SQLAllocHandle.c][463]
               Exit:[SQL_SUCCESS]
                       Output Handle = 0x87b62e8
[ODBC][9365][SQLSetConnectAttr.c][318]
               Entry:
                       Connection = 0x87b62e8
                       Attribute = SQL_ATTR_LOGIN_TIMEOUT
                       Value = 0xa
                       StrLen = 0
[ODBC][9365][SQLSetConnectAttr.c][500]
               Exit:[SQL_SUCCESS]
[ODBC][9365][SQLConnect.c][3549]
               Entry:
                       Connection = 0x87b62e8
                       Server Name = [asterisk][length = 8 (SQL_NTS)]
                       User Name = [asterisk_user][length = 13 (SQL_NTS)]
                       Authentication = [*************][length = 13 (SQL_NTS)]
               UNICODE Using encoding ASCII 'ISO8859-1' and UNICODE 'UCS-2LE'

[ODBC][9365][SQLConnect.c][4123]
               Exit:[SQL_SUCCESS_WITH_INFO]
[ODBC][9365][SQLAllocHandle.c][510]
               Entry:
                       Handle Type = 3
                       Input Handle = 0x87b62e8
[ODBC][9365][SQLAllocHandle.c][872]
               Exit:[SQL_SUCCESS]
                       Output Handle = 0x87cb368
[ODBC][9365][SQLPrepare.c][189]
               Entry:
                       Statement = 0x87cb368
                       SQL = [SELECT * FROM voicemail_users WHERE mailbox = ? AND context = ?][length = 63 (SQL_NTS)]
[ODBC][9365][SQLPrepare.c][364]
               Exit:[SQL_SUCCESS]
[ODBC][9365][SQLBindParameter.c][193]
               Entry:
                       Statement = 0x87cb368
                       Param Number = 1
                       Param Type = 1
                       C Type = 1 SQL_C_CHAR
                       SQL Type = 1 SQL_CHAR
                       Col Def = 1
                       Scale = 0
                       Rgb Value = 0xb78e2900
                       Value Max = 0
                       StrLen Or Ind = (nil)
[ODBC][9365][SQLBindParameter.c][339]
               Exit:[SQL_SUCCESS]
[ODBC][9365][SQLBindParameter.c][193]
               Entry:
                       Statement = 0x87cb368
                       Param Number = 2
                       Param Type = 1
                       C Type = 1 SQL_C_CHAR
                       SQL Type = 1 SQL_CHAR
                       Col Def = 7
                       Scale = 0
                       Rgb Value = 0x3b444a
                       Value Max = 0
                       StrLen Or Ind = (nil)
[ODBC][9365][SQLBindParameter.c][339]
               Exit:[SQL_SUCCESS]
[ODBC][9365][SQLExecute.c][183]
               Entry:
                       Statement = 0x87cb368
-------------------------------
Comments:By: Andrey S Pankov (casper) 2006-04-12 11:21:24

You should not use both mysql and odbc. If you use odbc, please connect to mysql with odbc driver. This is a known issue a.f.a.i.k.

By: Tilghman Lesher (tilghman) 2006-04-12 11:51:59

If you're going to report this as a crash, I need you to compile without optimizations:  i.e. "make clean dont-optimize", and I need you to upload a stack backtrace AS A FILE into the file upload area, not pasted into a bugnote.

By: Leo Burd (leoburd) 2006-04-12 14:16:55

sorry for the question, but how do I get a stack backtrace?

By: Andrey S Pankov (casper) 2006-04-12 14:28:27

http://www.voip-info.org/wiki/view/Asterisk+debugging

By: Andrey S Pankov (casper) 2006-04-12 14:29:50

Please upload additional information, do not paste it directly...

By: Leo Burd (leoburd) 2006-04-13 06:06:35

Hello there,

For some reason, I couldn't upload the core file... Please download it from here:

  http://whatsup.media.mit.edu/public/core.29971.zip

Let me know if you need anything else.

Best,

Leo

By: Andrey S Pankov (casper) 2006-04-13 09:41:39

Core files are of little use outside your system... Please upload a _stack backtrace_ as Corydon asked.

By: Tilghman Lesher (tilghman) 2006-04-13 13:18:46

As stated before, we need a backtrace from a NON-OPTIMIZED BUILD.

By: Leo Burd (leoburd) 2006-04-13 13:50:48

I did that... is there any way for the check whether my build is non-optimized?

.L.

By: Andrey S Pankov (casper) 2006-04-13 13:53:13

make clean dont-optimize

This will build and _install_ asterisk and datafiles.

By: Leo Burd (leoburd) 2006-04-13 14:39:25

Hello there,

I did as you said and I'm not getting anything different... This is getting very frustrating...  What would you recommend?

.L.

By: Tilghman Lesher (tilghman) 2006-04-16 01:27:40

Try "thread apply all bt full"

By: David James (davidj) 2006-04-18 04:48:48

umm, oh yeah I think this is caused by misuse of checking if  (res != SQL_NO_DATA)) in the ODBC code.  Try removing where your backtrace calls anything that could evaluate this.  Mysql probably implements ODBC v3 which gives more info then what the flawed res_odbc code expects... ?? -d

By: Serge Vecher (serge-v) 2006-05-02 16:29:48

leoburd: is this still an issue?

By: Tilghman Lesher (tilghman) 2006-05-04 10:16:23

Can you reproduce this if you noload => res_config_mysql.so ?

By: Leo Burd (leoburd) 2006-05-08 09:49:43

Folks,

It may take a little while for me to get back to this issue.  My son has just been born and there are bunch of other things that I have to take care before trying to tackle this bug.  Sorry about that!

.L.

By: Mark Spencer (markster) 2006-05-11 03:31:07

Anymore feedback here on using *just* the ODBC driver?

By: Serge Vecher (serge-v) 2006-05-19 14:24:55

leoburd: take your time and if you are able to reproduce the problem in the latest stable after trying Corydon's suggestion, please feel free to reopen the issue. Please attach a backtrace from non-optimized build too. Thank and good luck with family expansion!