[asterisk-bugs] [JIRA] (ASTERISK-28422) Potential memory Leak in Confbridge
Richard Mudgett (JIRA)
noreply at issues.asterisk.org
Wed May 22 11:33:47 CDT 2019
[ https://issues.asterisk.org/jira/browse/ASTERISK-28422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=247214#comment-247214 ]
Richard Mudgett edited comment on ASTERISK-28422 at 5/22/19 11:33 AM:
----------------------------------------------------------------------
Hi,
Yes, there is a lot going on here so I will try to simplify it as much as possible. So when the call is received I setup some initial CONFBRIDGE stuff (I suspect this is stacking as well):
{noformat}
// set up bridge config
ast_setvar("CONFBRIDGE(bridge,internal_sample_rate)", "8000");
ast_setvar("CONFBRIDGE(bridge,record_conference)", "yes");
ast_setvar("CONFBRIDGE(bridge,record_file_append)", "yes");
ast_setvar("CONFBRIDGE(bridge,record_file_timestamp)", "no");
// set up user config
ast_setvar("CONFBRIDGE(user,quiet)", "yes");
ast_setvar("CONFBRIDGE(user,timeout)", "0");
ast_setvar("CONFBRIDGE(user,jitterbuffer)", "yes");
// set up menu config (keys)
for (i = 0; i < strlen(digits); i++) {
sprintf(c, "%c", digits[i]);
k = !strcmp(c, "*") ? -1 : !strcmp(c, "#") ? -2 : atoi(c);
sprintf(var, "CONFBRIDGE(menu,%s)", c);
sprintf(val, "dialplan_exec(confkey,%d,1),leave_conference", k);
ast_setvar(var, val);
}
{noformat}
Then I basically have a loop when they join the conf
{noformat}
while (1) {
..
ast_confjoin(bridge, mute, moh ? confmusic_getstation() : NULL);
..
}
{noformat}
then in ast_confjoin I have the stuff from my OP:
{noformat}
int ast_confjoin(int bridge, int mute, char *music)
{
char recfn[256];
sprintf(recfn, "%s/%d.wav", path_confrec, bridge);
ast_setvar("CONFBRIDGE(bridge,record_file)", recfn);
ast_setvar("CONFBRIDGE(user,startmuted)", mute ? "yes" : "no");
ast_setvar("CONFBRIDGE(user,music_on_hold_class)", music ? music : "default");
ast_setvar("CONFBRIDGE(user,music_on_hold_when_empty)", music ? "yes" : "no");
sprintf(astcmd, "EXEC CONFBRIDGE %d", bridge);
strcpy(astres, ast_sendcmd(astcmd));
...
}
{noformat}
I suspect an easy way to reproduce this is to make one function that has all the initial CONFBRIDGE stuff along with all the looped stuff and then do:
{noformat}
ast_setvar("CONFBRIDGE(user,timeout)", "1");
{noformat}
As that will only keep you on the bridge for 1 second so it will constantly leave and join and run the CONFBRIDGE stuff over and over.
Hopefully this helps.
was (Author: tgwaste):
Hi,
Yes, there is a lot going on here so I will try to simplify it as much as possible. So when the call is received I setup some initial CONFBRIDGE stuff (I suspect this is stacking as well):
// set up bridge config
ast_setvar("CONFBRIDGE(bridge,internal_sample_rate)", "8000");
ast_setvar("CONFBRIDGE(bridge,record_conference)", "yes");
ast_setvar("CONFBRIDGE(bridge,record_file_append)", "yes");
ast_setvar("CONFBRIDGE(bridge,record_file_timestamp)", "no");
// set up user config
ast_setvar("CONFBRIDGE(user,quiet)", "yes");
ast_setvar("CONFBRIDGE(user,timeout)", "0");
ast_setvar("CONFBRIDGE(user,jitterbuffer)", "yes");
// set up menu config (keys)
for (i = 0; i < strlen(digits); i++) {
sprintf(c, "%c", digits[i]);
k = !strcmp(c, "*") ? -1 : !strcmp(c, "#") ? -2 : atoi(c);
sprintf(var, "CONFBRIDGE(menu,%s)", c);
sprintf(val, "dialplan_exec(confkey,%d,1),leave_conference", k);
ast_setvar(var, val);
}
Then I basically have a loop when they join the conf
while (1) {
..
ast_confjoin(bridge, mute, moh ? confmusic_getstation() : NULL);
..
}
then in ast_confjoin I have the stuff from my OP:
int ast_confjoin(int bridge, int mute, char *music)
{
char recfn[256];
sprintf(recfn, "%s/%d.wav", path_confrec, bridge);
ast_setvar("CONFBRIDGE(bridge,record_file)", recfn);
ast_setvar("CONFBRIDGE(user,startmuted)", mute ? "yes" : "no");
ast_setvar("CONFBRIDGE(user,music_on_hold_class)", music ? music : "default");
ast_setvar("CONFBRIDGE(user,music_on_hold_when_empty)", music ? "yes" : "no");
sprintf(astcmd, "EXEC CONFBRIDGE %d", bridge);
strcpy(astres, ast_sendcmd(astcmd));
...
}
I suspect an easy way to reproduce this is to make one function that has all the initial CONFBRIDGE stuff along with all the looped stuff and then do:
ast_setvar("CONFBRIDGE(user,timeout)", "1");
As that will only keep you on the bridge for 1 second so it will constantly leave and join and run the CONFBRIDGE stuff over and over.
Hopefully this helps.
> Potential memory Leak in Confbridge
> -----------------------------------
>
> Key: ASTERISK-28422
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-28422
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Applications/app_confbridge
> Affects Versions: 16.3.0
> Environment: Debian GNU/Linux 9.8 (stretch)
> Using AGI
> Reporter: Ted G
> Assignee: Unassigned
> Severity: Minor
>
> When users on my system join a conference bridge some variables are being set dynamically like so:
> ast_setvar("CONFBRIDGE(bridge,record_file)", recfn);
> ast_setvar("CONFBRIDGE(user,startmuted)", mute ? "yes" : "no");
> ast_setvar("CONFBRIDGE(user,music_on_hold_class)", music ? music : "default");
> ast_setvar("CONFBRIDGE(user,music_on_hold_when_empty)", music ? "yes" : "no");
> All of this works fine, however users are quite often taken off the bridge to change these settings so every time they enter the bridge these settings are applied based on whatever configuration they are using.
> My assumption is that once the channel is destroyed (upon Hangup) these settings vanish. I am not using confbridge.conf at all.
> My assumption appears false however as memory usage continues to grow day by day:
> 54616804 bytes in 15255 allocations in file confbridge/conf_config_parser.c
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list