[asterisk-bugs] [JIRA] (ASTERISK-26505) Using res_odbc module for querying a longBLOB column causes a big memory usage
Leandro Dardini (JIRA)
noreply at issues.asterisk.org
Tue Nov 1 05:19:10 CDT 2016
[ https://issues.asterisk.org/jira/browse/ASTERISK-26505?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=233211#comment-233211 ]
Leandro Dardini commented on ASTERISK-26505:
--------------------------------------------
I don't think the MALLOC_DEBUG will be of any help, but here are all the files. Due to the fact I don't see any useful information in the log file, I run a strace on asterisk where at least I can see the mmap for 4 GB memory.
I run this command, just to avoid any misunderstanding on the output generated:
strace -f -F -p 12741 -e trace=memory &>/tmp/issue26505-strace-memory.txt & ps aux | grep "/usr/sbin/asterisk" | tee /tmp/issue26505-ps-predial.txt ; asterisk -rx 'logger add channel debug_log_26505 notice,warning,error,debug,verbose,dtmf'; asterisk -rx 'core set verbose 5'; asterisk -rx 'core set debug 5'; asterisk -rx 'module reload logger'; asterisk -rx 'logger rotate' ; asterisk -rx 'memory backtrace on' ; echo "Dial 9999" ; read ; ps aux | grep "/usr/sbin/asterisk" | tee /tmp/issue26505-ps-postdial.txt ; asterisk -rx 'memory show summary' | tee /tmp/issue26505-memory_show_summary.txt ; asterisk -rx 'memory show allocations' | tee /tmp/issue26505-memory_show_allocations
The actual extension code run was:
{noformat}
9999 => {
Answer();
Set(HASH(extension)=${ODBC_READ_EXTENSIONS(5)});
NoOp(I have loaded ${HASH(extension,ex_name)});
Wait(60);
Hangup();
}
{noformat}
And the func_odbc.conf used was:
{noformat}
[READ_EXTENSIONS]
dsn=asterisk1,asterisk2
synopsis=Retrieve the extension data
readsql=SELECT * FROM ex_extensions where ex_id='${ARG1}'
{noformat}
The table definition is
{noformat}
CREATE TABLE IF NOT EXISTS `ex_extensions` (
`ex_id` int(11) NOT NULL AUTO_INCREMENT,
`ex_te_id` int(11) NOT NULL,
`ex_name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ex_tech` enum('SIP','IAX2','VIRTUAL','PJSIP') COLLATE utf8_unicode_ci DEFAULT NULL,
`ex_number` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
`ex_trunk` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ex_tech_id` int(11) NOT NULL,
`ex_cidnum` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`ex_cidname` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ex_cidusage` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`ex_blockcid` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`ex_prefix` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`ex_mindigitprefix` int(11) NOT NULL,
`ex_maxdigitprefix` int(11) NOT NULL,
`ex_fmfmstatus` char(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`ex_fmfmnumber` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`ex_fmfmdialtimeout` int(11) NOT NULL,
`ex_fmfmdialmethod` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
`ex_fmfmcallerid` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`ex_fmfmnumprefix` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`ex_fmfmnameprefix` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ex_recording` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'no',
`ex_dialtimeout` int(11) NOT NULL,
`ex_callgroup` int(11) NOT NULL,
`ex_pickupgroup` int(11) NOT NULL,
`ex_unconditionalstatus` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`ex_onbusystatus` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`ex_onofflinestatus` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`ex_onnoanswerstatus` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`ex_callallowed` varchar(40) COLLATE utf8_unicode_ci DEFAULT 'all',
`ex_destallowregex` varchar(255) COLLATE utf8_unicode_ci DEFAULT '',
`ex_rp_id` int(11) NOT NULL,
`ex_dnd` varchar(16) COLLATE utf8_unicode_ci NOT NULL,
`ex_emergencycidnum` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
`ex_webpassword` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ex_up_id` int(11) NOT NULL,
`ex_userpanel` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`ex_datecreation` datetime DEFAULT NULL,
`ex_emailrecording` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ex_fmfmconfirm` varchar(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`ex_fmfmconfirmmessage_id` int(11) NOT NULL,
`ex_minemailrecording` int(11) NOT NULL,
`ex_branch` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ex_department` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ex_autocallerid` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'on',
`ex_trunkcidoverride` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ex_trunkemergencycidoverride` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ex_cr_id` int(11) NOT NULL,
`ex_trunkcidsource` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,
`ex_description` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ex_fmfmholdmessage_id` int(11) NOT NULL,
`ex_notifymissingemail` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`ex_webuseldap` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`ex_webuser` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ex_txvolume` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ex_rxvolume` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ex_mu_id` int(11) DEFAULT '0',
`ex_faxgateway` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ex_faxalert` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ex_trunkdid` varchar(50) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ex_fmfmdelay` int(11) NOT NULL DEFAULT '0',
`ex_includeindbn` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'yes',
`ex_abusedetection` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ex_referenceid` varchar(40) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`ex_notes` longblob,
UNIQUE KEY `ex_id` (`ex_id`),
KEY `ex_tech_id` (`ex_tech_id`),
KEY `ex_te_id` (`ex_te_id`,`ex_number`)
)
{noformat}
> Using res_odbc module for querying a longBLOB column causes a big memory usage
> ------------------------------------------------------------------------------
>
> Key: ASTERISK-26505
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-26505
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Resources/res_odbc
> Affects Versions: 13.2.0, 13.4.0, 13.11.2
> Environment: CentOS 6.x 64 bit, Mysql 5.1
> Reporter: Leandro Dardini
> Assignee: Leandro Dardini
> Severity: Minor
>
> Please note I have listed the versions where I tried this. Not listed version were not tested.
> If I have a table with a longBLOB field (but probably it happens for any type of BLOB column) and I define in func_odbc.conf an entry like
> {noformat}
> [READ_EXTENSIONS]
> dsn=asterisk1,asterisk2
> synopsis=Retrieve the extension data
> readsql=SELECT * FROM ex_extensions where id='${ARG1}'
> {noformat}
> Using a function like
> {noformat}
> Set(HASH(phone)=${ODBC_READ_EXTENSIONS(56)});
> {noformat}
> The same command, using any other type of column, gives no problems at all.
> Determines an increase of virtual memory usage in Asterisk... I have seen it getting up to 30 GB on a medium sized server.
> When this abnormal memory usage happens, asterisk continue to work, but it cannot spawn external processes, like from res_agi.c:
> {noformat}
> [2016-10-26 10:04:18] WARNING[26880][C-000002bb] res_agi.c: Failed to fork(): Cannot allocate memory
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list