Summary:ASTERISK-09114: [patch] res_config_odbc never reconnects
Reporter:Norman Franke (norman)Labels:
Date Opened:2007-03-27 10:48:46Date Closed:2007-08-07 13:59:07
Versions:Frequency of
Environment:Attachments:( 0) 20070720__bug9389_1.2.diff.txt
( 1) 20070805__bug9389.diff.txt
Description:If I restart my ODBC-connected database, MS SQL in my case, Astersik will not re-connect to the database when accessed via res_config_odbc, i.e. the ast_load_realtime() functions. res_odbc will try to do so, but since res_config_odbc calls SQLPrepare directly instead of using res_odbc's ast_odbc_prepare_and_execute functions, res_config_odbc will this never reconnect and all subsequent queries fail.
Comments:By: Joshua C. Colp (jcolp) 2007-05-17 11:32:26

Here Corydon, ODBC!

By: Tilghman Lesher (tilghman) 2007-05-17 18:19:36

Please test the uploaded patch to ensure it solves your issue.

By: Tilghman Lesher (tilghman) 2007-05-30 00:12:55

norman:  I need your test results, please.

By: Norman Franke (norman) 2007-05-30 00:42:56

Will get back to you. I've been on vacation.

By: TSS Support (keith) (tss) 2007-06-04 12:21:46

Any chance of this being back ported? We're having this issue with 1.2, trying to run realtime off a separate database server. Of course we can move to 1.4 but if this would be easy to make happen on 1.2 that would save us a lot of work in testing.

By: Tilghman Lesher (tilghman) 2007-06-04 12:51:45

For MS SQL Server?  No.  SQL Server is not supported on 1.2.  There were architectural changes made in 1.4 to support SQL Server, but it will never be workable in 1.2.

By: Norman Franke (norman) 2007-06-04 13:19:04

I applied it to my 1.4.2 installation, and it did work as desired. It connected, I queried it, I brought the DB down, the lookup failed, I brought it back up, it reconnected and queried.

By: TSS Support (keith) (tss) 2007-06-04 13:33:06

I should have been much clearer: we are using ODBC to connect to a Postgres database. If the Postgres server is restarted for some reason, the most likely being heartbeat failover to a backup Postgres server, Asterisk never reconnects and just starts failing queries.

By: Tilghman Lesher (tilghman) 2007-06-05 14:25:25

Full conversion for 1.2 uploaded.

By: Tilghman Lesher (tilghman) 2007-06-20 14:38:30

tss:  does this patch work for you?

By: TSS Support (keith) (tss) 2007-06-20 15:54:15

With a little bit of manual patch application where we apparently had a different version of 1.2 checked out, it applied, compiled and connected and seemed to basically work. I haven't had a chance yet to test the reconnect functionality it's supposed to be implementing, mostly because we had a lot of blue smoke let out of equipment in the last few days. It'll likely get properly tested at the start of next week, and I'll update this issue then when full regression testing is complete.

By: Tilghman Lesher (tilghman) 2007-07-06 00:32:54

tss:  given that 2 weeks have passed, how is this patch working for you?

By: Tilghman Lesher (tilghman) 2007-07-13 16:30:18

tss: ping

By: TSS Support (keith) (tss) 2007-07-20 16:10:05

We are seeing some problems with the voicemail module, as in:

loader.c: /usr/lib/asterisk/modules/app_voicemail.so: undefined symbol: vm_delete

I suspect it has to do with imperfect manual patch application. Which version did you run this patch against so we can checkout the exact same revision and test with it? Thank you.

By: Tilghman Lesher (tilghman) 2007-07-20 16:44:50

Patch was against 1.2, revision 67307.

By: Tilghman Lesher (tilghman) 2007-07-20 17:04:55

I have updated the patch for 1.2 to revision 76215, the latest for today.

By: Tilghman Lesher (tilghman) 2007-07-30 11:38:55

Please note that 1.2 is going into maintenance mode as of Wednesday, so if I don't get feedback on the 1.2 patch before then, it is no longer candidate code for 1.2.

By: Tilghman Lesher (tilghman) 2007-08-05 09:46:57

As noted in the previous bugnote, this is no longer applicable to 1.2, as 1.2 is now in security-fixes-only mode.  I have left the patch for people who would like to use it in 1.2, however.

New candidate code uploaded for 1.4, which includes the necessary conversions to app_voicemail, app_directory, and res_config_odbc.

By: Digium Subversion (svnbot) 2007-08-07 13:52:05

Repository: asterisk
Revision: 78415

r78415 | tilghman | 2007-08-07 13:52:04 -0500 (Tue, 07 Aug 2007) | 2 lines

Reconnection doesn't happen automatically when a DB goes down (fixes issue ASTERISK-9114)


By: Digium Subversion (svnbot) 2007-08-07 13:57:11

Repository: asterisk
Revision: 78417

r78417 | tilghman | 2007-08-07 13:57:11 -0500 (Tue, 07 Aug 2007) | 10 lines

Merged revisions 78415 via svnmerge from

r78415 | tilghman | 2007-08-07 14:09:38 -0500 (Tue, 07 Aug 2007) | 2 lines

Reconnection doesn't happen automatically when a DB goes down (fixes issue ASTERISK-9114)