[Home]

Summary:ASTERISK-13924: Asterisk Realtime - res_odbc failing MySQL connection on rtupdate=yes
Reporter:Josh Metzger (jdmetzger)Labels:
Date Opened:2009-04-08 11:03:15Date Closed:2011-06-07 14:02:49
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_odbc
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:After upgrading from Asterisk 1.4.20 to 1.4.24, the following error was appearing in the Asterisk CLI whenever a SIP phone would re-register:

[Apr  8 09:50:54] WARNING[5601]: res_odbc.c:105 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 42S21: [MySQL][ODBC 3.51 Driver][mysqld-5.0.22]Unknown column 'lastms' in 'field list' (79)
[Apr  8 09:50:54] WARNING[5601]: res_odbc.c:113 ast_odbc_prepare_and_execute: SQL Execute error -1! Attempting a reconnect...
[Apr  8 09:50:54] NOTICE[5601]: res_odbc.c:533 odbc_obj_connect: Connecting asterisk
[Apr  8 09:50:54] NOTICE[5601]: res_odbc.c:561 odbc_obj_connect: res_odbc: Connected to asterisk [asterisk-connector]
[Apr  8 09:50:54] WARNING[5601]: res_odbc.c:105 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: 42S21: [MySQL][ODBC 3.51 Driver][mysqld-5.0.22]Unknown column 'lastms' in 'field list' (79)
[Apr  8 09:50:54] WARNING[5601]: res_odbc.c:113 ast_odbc_prepare_and_execute: SQL Execute error -1! Attempting a reconnect...
[Apr  8 09:50:54] NOTICE[5601]: res_odbc.c:533 odbc_obj_connect: Connecting asterisk
[Apr  8 09:50:54] NOTICE[5601]: res_odbc.c:561 odbc_obj_connect: res_odbc: Connected to asterisk [asterisk-connector]

With this error, the system would continue running (no crash), but the Realtime information is not being sent successfully to the Realtime Database.  Disabling realtime updates by setting "rtupdate=no" in sip.conf and doing a "sip reload" will stop the error.  Going back and changing "rtupdate=yes" in sip.conf and doing another "sip reload" brings the error back.  Error does not occur with Asterisk 1.4.20.

Seems similar to bug ASTERISK-1368784 but without a segfault.

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

Host:

Dell Poweredge 2950 (dual Intel Xeon E5430 2.66GHz CPUs)
Redhat Enterprise Linux 5.1 x86_64
kernel: 2.6.18-53.el5 #1 SMP

/etc/asterisk/res_odbc:

[asterisk]
enabled => yes
dsn => asterisk-connector
username => *****
password => *****
pre-connect => yes
pooling => no

/etc/odbc.ini:

[asterisk-connector]
Description             = MySQL connection to "asterisk" database
Driver                  = MySQL
Database                = asterisk
Servername              = localhost
Port                    = 3306
UserName                = *****
Password                = *****
Protocol                = 7.4
ReadOnly                = No
RowVersioning           = No
ShowSystemTables        = No
ShowOidColumn           = No
FakeOidIndex            = No
ConnSettings            =

/etc/odbcinst.ini:

[MySQL]
Description     = ODBC for MySQL
Driver          = /usr/lib64/libmyodbc3.so
Setup           = /usr/lib64/libodbcmyS.so
FileUsage       = 1

MYSQL versions:

mysql.i386                               5.0.22-2.1.0.1        
mysql.x86_64                             5.0.22-2.1.0.1              
mysql-devel.i386                         5.0.22-2.1.0.1      
mysql-devel.x86_64                       5.0.22-2.1.0.1      
mysql-server.x86_64                      5.0.22-2.1.0.1      

ODBC versions:

mysql-connector-odbc.x86_64              3.51.12-2.2      
unixODBC.i386                            2.2.11-7.1          
unixODBC.x86_64                          2.2.11-7.1          
unixODBC-devel.x86_64                    2.2.11-7.1      

     
Comments:By: Tilghman Lesher (tilghman) 2009-04-08 11:38:43

If you want the error to go away, please add the lastms column to your database.  However, the error generated by the MySQL driver is completely superfluous, as this does not affect the functionality of rtupdate in any significant way.