[Home]

Summary:ASTERISK-11266: [patch] Idle check for res_odbc
Reporter:Tilghman Lesher (tilghman)Labels:
Date Opened:2008-01-19 12:03:15.000-0600Date Closed:2008-01-21 12:26:22.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_odbc
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20080119__res_odbc__idlecheck.diff.txt
( 1) 20080119__res_odbc__idlecheck-mvanbaak.diff.txt
( 2) odbc_ast_tvdiff_sec.diff.txt
Description:When a database connection remains idle for too long, it may sometimes become stale.  This patch makes Asterisk more proactive in the approach, in that we can set a max idle time, at which res_odbc will automatically reconnect instead of waiting for a query to fail first.  This should improve some performance, as well as eliminating ugly logs about the database connection having timed out.
Comments:By: Michiel van Baak (mvanbaak) 2008-01-19 12:20:27.000-0600

I took out the acl.c changes that are from corydon's local tree and dont belong to this one.
Also fixed spelling error in config file.

Compiles and runs. Will report tomorrow if it's still running.

By: Michiel van Baak (mvanbaak) 2008-01-20 09:56:38.000-0600

Asterisk has been idle all night and day, and I received a call just 10 minutes ago. I had the same yesterday and back then it coredumped. I'm now running with this patch and no more coredump. This is the new log:

[2008-01-20 16:52:23] WARNING[6314]: res_odbc.c:535 odbc_obj_disconnect: res_odbc: customer-a [customer-a] already disconnected
[2008-01-20 16:52:23] NOTICE[6314]: res_odbc.c:571 odbc_obj_connect: Re-connecting customer-a
[2008-01-20 16:52:23] NOTICE[6314]: res_odbc.c:587 odbc_obj_connect: res_odbc: Connected to customer-a [customer-a]
[2008-01-20 16:52:23] WARNING[6314]: res_odbc.c:121 ast_odbc_prepare_and_execute: SQL Execute returned an error -1: HYT00: [MySQL][ODBC 3.51 Driver][mysqld-5.0.32-Debian_7etch4-log]MySQL server has gone away (84)                                                                                                                                                                                                                
[2008-01-20 16:52:23] WARNING[6314]: res_odbc.c:129 ast_odbc_prepare_and_execute: SQL Execute error -1! Attempting a reconnect...
[2008-01-20 16:52:23] WARNING[6314]: res_odbc.c:221 ast_odbc_sanity_check: Connection is down attempting to reconnect...
[2008-01-20 16:52:28] WARNING[6314]: res_odbc.c:533 odbc_obj_disconnect: res_odbc: disconnected 0 from customer-b [customer-b]
[2008-01-20 16:52:28] NOTICE[6314]: res_odbc.c:573 odbc_obj_connect: Connecting customer-b
[2008-01-20 16:52:28] NOTICE[6314]: res_odbc.c:587 odbc_obj_connect: res_odbc: Connected to customer-b [customer-b]
 == Spawn extension (internal, sw-13-6002, 10) exited non-zero on 'Local/6002@internal-d65d;2'
 == Spawn extension (from-provider, sw-14-31318XXXXXX, 20) exited non-zero on 'IAX2/vanbaak-8'
   -- Hungup 'IAX2/vanbaak-8'
 == Spawn extension (internal, sw-13-6000, 10) exited non-zero on 'Local/6000@internal-0d22;2'

So it really does fix the crash.
+1 from me for commit

By: Tilghman Lesher (tilghman) 2008-01-20 18:25:02.000-0600

If you make the case, we might could put this in 1.4, too.

By: Michiel van Baak (mvanbaak) 2008-01-21 01:16:20.000-0600

We can see this as a bug.
I know the bug is actually in the mysql driver for ODBC, but it's nice to have a workaround in asterisk.

I wont be able to look at patching 1.4 for the next 12 hours, so I bet you'll have it committed before I return to my pc.

By: Digium Subversion (svnbot) 2008-01-21 12:08:32.000-0600

Repository: asterisk
Revision: 99341

U   branches/1.4/configs/res_odbc.conf.sample
U   branches/1.4/include/asterisk/res_odbc.h
U   branches/1.4/res/res_odbc.c

------------------------------------------------------------------------
r99341 | tilghman | 2008-01-21 12:08:31 -0600 (Mon, 21 Jan 2008) | 8 lines

Permit the user to specify number of seconds that a connection may remain idle,
which fixes a crash on reconnect with the MyODBC driver.
(closes issue ASTERISK-11266)
Reported by: Corydon76
Patches:
      20080119__res_odbc__idlecheck.diff.txt uploaded by Corydon76 (license 14)
Tested by: mvanbaak

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=99341

By: Digium Subversion (svnbot) 2008-01-21 12:13:30.000-0600

Repository: asterisk
Revision: 99350

_U  trunk/
U   trunk/configs/res_odbc.conf.sample
U   trunk/include/asterisk/res_odbc.h
U   trunk/res/res_odbc.c

------------------------------------------------------------------------
r99350 | tilghman | 2008-01-21 12:13:29 -0600 (Mon, 21 Jan 2008) | 16 lines

Merged revisions 99341 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r99341 | tilghman | 2008-01-21 12:11:07 -0600 (Mon, 21 Jan 2008) | 8 lines

Permit the user to specify number of seconds that a connection may remain idle,
which fixes a crash on reconnect with the MyODBC driver.
(closes issue ASTERISK-11266)
Reported by: Corydon76
Patches:
      20080119__res_odbc__idlecheck.diff.txt uploaded by Corydon76 (license 14)
Tested by: mvanbaak

........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=99350