[Home]

Summary:ASTERISK-05874: Small cummulative memory consumption using application MYSQL
Reporter:Jon Brüel (jb)Labels:
Date Opened:2005-12-20 03:49:45.000-0600Date Closed:2006-01-31 11:43:16.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:In version 1.2.1 the application MYSQL does not release all the memory used. Approximately 220 Bytes are not released. It has been tested to apply for SELECT and INSERT INTO queries.

The version of app_addon_sql_mysql.c is dated Nov 29 2005 (11703 Bytes).

This does not happen in version 1.0.10 (same MYSQL based macro used), where the version of app_addon_sql_mysql.c is dated Sep 17 2005, (11612 Bytes).


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

SQL version: 3.23.58
Linux version: FC 2.
Servertype: i686
Comments:By: Matthew Fredrickson (mattf) 2006-01-17 11:53:32.000-0600

Can you post a sample of how you use this in  your dialplan?  That would help us to understand how it might be breaking.

By: Jon Brüel (jb) 2006-01-18 10:21:53.000-0600

The MYSQL application is used via three macros, which are called in various places in the dialplan as replacement for the former ODBC-applications. As mentioned, this usage does not give any problems in 1.0.10:

delete:
${ARG1} Family, ${ARG2} Key
s,1,MYSQL(Connect connectid localhost asterisk secret asterisk)
s,2,Set(resultid=0)
s,3,MYSQL(Query resultid ${connectid} DELETE FROM astdb WHERE astfamily = \'${ARG1}\' AND astkey = \'${ARG2}\')
s,4,Set(resultid=${resultid})
s,5,MYSQL(Disconnect ${connectid})

get:
${ARG1} Varname, ${ARG2} Family, ${ARG3} Key
s,1,MYSQL(Connect connectid localhost asterisk secret asterisk)
s,2,Set(resultid=0)
s,3,MYSQL(Query resultid ${connectid} SELECT astvalue FROM astdb WHERE astfamily=\'${ARG2}\' AND astkey=\'${ARG3}\')
s,4,GotoIf($[${resultid} = 0]?14:10)
s,10,MYSQL(Fetch fetchid ${resultid} ${ARG1})
s,11,GotoIf($[${fetchid} = 0]?13:12)
s,12,Set(databasevalue=${${ARG1}})
s,13,MYSQL(Clear ${resultid})
s,14,MYSQL(Disconnect ${connectid})
s,15,NoOp

put:
${ARG1} Family, ${ARG2} Key, ${ARG3} Value inserted
s,1,MYSQL(Connect connectid localhost asterisk secret asterisk)
s,2,Set(resultid=0)
s,3,MYSQL(Query resultid ${connectid} REPLACE INTO astdb (astfamily\,astkey\,astvalue) VALUES (\'${ARG1}\'\,\'${ARG2}\'\,\'${ARG3}\'))
s,4,Set(resultid=${resultid})
s,5,MYSQL(Disconnect ${connectid})

By: Tilghman Lesher (tilghman) 2006-01-21 23:48:59.000-0600

According to the MySQL API, you need to call the Clear command on every single Query, whether or not it returns rows.  If you ever forget to run the Clear command or if the channel hangs up prior to calling either the Clear or Disconnect commands, that could possibly account for the missing memory.

By: Jon Brüel (jb) 2006-01-31 03:06:21.000-0600

The same dialplan has now been tested with Asterisk version 1.2.4 and asterisk-addons version 1.2.1. The problem does not exist anymore with these versions, so the issue may be closed.

By: Matthew Fredrickson (mattf) 2006-01-31 11:43:03.000-0600

Fixed in later version.