[Home]

Summary:ASTERISK-12065: ODBC connections are not being pooled or reused.
Reporter:Private Name (falves11)Labels:
Date Opened:2008-05-21 16:15:53Date Closed:2008-05-23 16:15:37
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Resources/res_odbc
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20080521__bug12704.diff.txt
( 1) func_odbc_blowup_x2.txt
Description:This is what I observe after using version 117297 in production: the number of connections grow about 60 a day, but I have just a few calls open on the server. If they were reused, the max amount of connections should not grow to more tha maybe 20 or less, since I don't need to hit the database at the same time. So there is a loose end here somewhere. The pool does not reuse the connections properly or cannnot tell if they are idle.

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

My machine is open for inspection from the developer. I can measure the amount of connections open from the SQL Server side, with a simple SQL statement.
Comments:By: Tilghman Lesher (tilghman) 2008-05-21 16:29:01

What is the output of "odbc show"?

By: Private Name (falves11) 2008-05-21 16:48:56

SQL Servers sees 43 connections

ODBC DSN Settings
-----------------

 Name:   global
 DSN:    mssql
 Pooled: Yes
 Limit:  1000
 Connections in use: 34
   - Connection 1: connected
   - Connection 2: connected
   - Connection 3: connected
   - Connection 4: connected
   - Connection 5: connected
   - Connection 6: connected
   - Connection 7: connected
   - Connection 8: connected
   - Connection 9: connected
   - Connection 10: connected
   - Connection 11: connected
   - Connection 12: connected
   - Connection 13: connected
   - Connection 14: connected
   - Connection 15: connected
   - Connection 16: connected
   - Connection 17: connected
   - Connection 18: connected
   - Connection 19: connected
   - Connection 20: connected
   - Connection 21: connected
   - Connection 22: connected
   - Connection 23: connected
   - Connection 24: connected
   - Connection 25: connected
   - Connection 26: connected
   - Connection 27: connected
   - Connection 28: connected
   - Connection 29: connected
   - Connection 30: connected
   - Connection 31: connected
   - Connection 32: connected
   - Connection 33: connected
   - Connection 34: connected

 Name:   routing
 DSN:    routing
 Pooled: Yes
 Limit:  1000
 Connections in use: 9
   - Connection 1: connected
   - Connection 2: connected
   - Connection 3: connected
   - Connection 4: connected
   - Connection 5: connected
   - Connection 6: connected
   - Connection 7: connected
   - Connection 8: connected
   - Connection 9: connected


Since I have a separate connection for routing, this means that cdr_odbc is using 34 connections alone. I have 64 open calls. The routing connections via func_odbc seem to be OK. Therefore, cdr_odbc is the culprit. There is no way that with 64 calls open I could have so many cdr_connections. And they keep growing. Tomorrow I can read the number again.

By: Private Name (falves11) 2008-05-21 16:54:40

I typed "odbc show"  and it crashed.

By: Tilghman Lesher (tilghman) 2008-05-21 17:34:00

The fact that they all show up as "connected" means that none of them are in use, so you did, in fact, have a point in time at which 34 different calls were in the process of posting their CDRs.  If this seems off to you, you might want to look at the number of indices you have on your CDR table, as a long INSERT time tends to indicate a lot of contention.

By: Tilghman Lesher (tilghman) 2008-05-21 17:36:14

For that crash, let's try this patch.

By: Tilghman Lesher (tilghman) 2008-05-23 07:27:03

Since you haven't replied yet, does that mean that this patch fixed the problem for you?

By: Private Name (falves11) 2008-05-23 12:35:19

yes, the patch works. Please. Please commit it.

By: Digium Subversion (svnbot) 2008-05-23 13:03:11

Repository: asterisk
Revision: 118129

U   trunk/res/res_odbc.c

------------------------------------------------------------------------
r118129 | tilghman | 2008-05-23 13:03:09 -0500 (Fri, 23 May 2008) | 3 lines

Protect the object from changing while the 'odbc show' CLI command is running
(Closes issue ASTERISK-12065)

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

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

By: Digium Subversion (svnbot) 2008-05-23 13:09:42

Repository: asterisk
Revision: 118130

_U  branches/1.6.0/
U   branches/1.6.0/res/res_odbc.c

------------------------------------------------------------------------
r118130 | tilghman | 2008-05-23 13:09:38 -0500 (Fri, 23 May 2008) | 11 lines

Merged revisions 118129 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

........
r118129 | tilghman | 2008-05-23 13:09:14 -0500 (Fri, 23 May 2008) | 3 lines

Protect the object from changing while the 'odbc show' CLI command is running
(Closes issue ASTERISK-12065)

........

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

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

By: Digium Subversion (svnbot) 2008-05-23 16:15:37

Repository: asterisk
Revision: 118162

_U  team/seanbright/resolve-shadow-warnings/
U   team/seanbright/resolve-shadow-warnings/CHANGES
U   team/seanbright/resolve-shadow-warnings/apps/app_chanisavail.c
U   team/seanbright/resolve-shadow-warnings/apps/app_voicemail.c
U   team/seanbright/resolve-shadow-warnings/channels/chan_gtalk.c
U   team/seanbright/resolve-shadow-warnings/channels/chan_usbradio.c
U   team/seanbright/resolve-shadow-warnings/channels/chan_vpb.cc
A   team/seanbright/resolve-shadow-warnings/configs/pbx_realtime.conf
A   team/seanbright/resolve-shadow-warnings/doc/cli.txt
U   team/seanbright/resolve-shadow-warnings/include/asterisk/utils.h
U   team/seanbright/resolve-shadow-warnings/main/utils.c
U   team/seanbright/resolve-shadow-warnings/pbx/pbx_realtime.c
U   team/seanbright/resolve-shadow-warnings/res/res_jabber.c
U   team/seanbright/resolve-shadow-warnings/res/res_odbc.c

------------------------------------------------------------------------
r118162 | seanbright | 2008-05-23 16:15:24 -0500 (Fri, 23 May 2008) | 127 lines

Merged revisions 117983,117986,117988,118020,118049,118053,118059,118101,118129,118157,118159 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk

................
r117983 | tilghman | 2008-05-22 17:27:00 -0400 (Thu, 22 May 2008) | 2 lines

Fix trunk breakage

................
r117986 | tilghman | 2008-05-22 17:42:50 -0400 (Thu, 22 May 2008) | 2 lines

Add a compatibility option for upgrading realtime extensions

................
r117988 | seanbright | 2008-05-22 17:43:54 -0400 (Thu, 22 May 2008) | 1 line

Split the compile flags out and wire up some dependencies
................
r118020 | phsultan | 2008-05-23 06:33:21 -0400 (Fri, 23 May 2008) | 15 lines

- remove whitespaces between tags in received XML packets before giving
them to the parser ;
- report Gtalk error messages from a buddy to the console.

This patch makes Asterisk "Google Jingle" (chan_gtalk) implementation
work with Empathy. Note that this is only true for audio streams, not
video.

Thank you to PH for his great help!

(closes issue ASTERISK-12017)
Reported by: PH
Patches:
     trunk-12647-1.diff uploaded by phsultan (license 73)
Tested by: phsultan, PH
................
r118049 | russell | 2008-05-23 08:37:31 -0400 (Fri, 23 May 2008) | 17 lines

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

........
r118048 | russell | 2008-05-23 07:30:53 -0500 (Fri, 23 May 2008) | 9 lines

Don't declare a function that takes variable arguments as inline, because it's
not valid, and on some compilers, will emit a warning.

http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline

(closes issue ASTERISK-11712)
Reported by: francesco_r
Patches by Tilghman, final patch by me

........

................
r118053 | tilghman | 2008-05-23 09:00:10 -0400 (Fri, 23 May 2008) | 11 lines

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

........
r118052 | tilghman | 2008-05-23 07:59:16 -0500 (Fri, 23 May 2008) | 3 lines

Add information on using the Asterisk console, including tab command line
completion.  (Closes issue ASTERISK-12044)

........

................
r118059 | tilghman | 2008-05-23 09:20:13 -0400 (Fri, 23 May 2008) | 9 lines

Blocked revisions 118055 via svnmerge

........
r118055 | tilghman | 2008-05-23 08:18:44 -0500 (Fri, 23 May 2008) | 2 lines

Add format type checking for recently de-inlined function

........

................
r118101 | mvanbaak | 2008-05-23 13:12:04 -0400 (Fri, 23 May 2008) | 15 lines

add option 'a' to chanisavail.
If you give chanisavail a list of channels, it will only
return the first available channel.
When this option is set, it will return all the available
channels from the given list.

(closes issue ASTERISK-11673)
Reported by: dagmoller
Patches:
     app_chanisavail-snv.patch-v2.txt uploaded by dagmoller (license 436)
  - major changes by me because russellb pointed out some buffer overflows
    and codeguideline issues.
Converted it all to the ast_str_* api
Tested by: dagmoller, mvanbaak

................
r118129 | tilghman | 2008-05-23 14:09:14 -0400 (Fri, 23 May 2008) | 3 lines

Protect the object from changing while the 'odbc show' CLI command is running
(Closes issue ASTERISK-12065)

................
r118157 | mmichelson | 2008-05-23 15:57:40 -0400 (Fri, 23 May 2008) | 10 lines

Use a deep copy on strings that come from ast_events. Otherwise it is
likely that after the event is freed, we no longer refer to valid memory.

(closes issue ASTERISK-12073)
Reported by: tomo1657
Patches:
     12712.patch uploaded by putnopvut (license 60)
Tested by: tomo1657


................
r118159 | mmichelson | 2008-05-23 16:55:02 -0400 (Fri, 23 May 2008) | 4 lines

Get rid of warnings for those silly compilers which warn when freeing
a const pointer


................

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

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