[asterisk-bugs] [JIRA] (ASTERISK-20786) Taskprocessors can leak memory
Joshua Colp (JIRA)
noreply at issues.asterisk.org
Tue Dec 19 05:15:07 CST 2017
[ https://issues.asterisk.org/jira/browse/ASTERISK-20786?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joshua Colp updated ASTERISK-20786:
-----------------------------------
Affects Version/s: 13.18.4
> Taskprocessors can leak memory
> ------------------------------
>
> Key: ASTERISK-20786
> URL: https://issues.asterisk.org/jira/browse/ASTERISK-20786
> Project: Asterisk
> Issue Type: Bug
> Security Level: None
> Components: Core/General
> Affects Versions: SVN, 1.8.19.0, 10.11.0, 11.1.0, 13.18.4
> Reporter: Mark Michelson
> Severity: Minor
>
> Taskprocessors work by having tasks pushed into them along with a pointer to some data. Since the task is handled in a separate thread from where the task was pushed, the task data is always heap-allocated.
> This task data is freed by the task once it has finished doing whatever processing is necessary. This is sufficient for the general majority of the time.
> However, when a taskprocessor gets shut down, any tasks currently queued in the taskprocessor will not have their task data freed since the tasks themselves will not be run. Currently, taskprocessor shutdown tends to correspond with Asterisk shutdown, so if there is any leaked memory, it is reclaimed by the kernel anyway.
> I propose that the taskprocessor API needs to be changed so that ast_taskprocessor_push() has a new parameter, a pointer to a "free" function. This free function is intended to free the allocated task data. This function will be called automatically by the taskprocessor after processing a task so that tasks themselves are no longer responsible for freeing the task data. In addition, during taskprocessor shutdown, the task data can be freed when the task queue is emptied out.
> Discussion will need to happen to determine if this change is important enough to allow for an API change in released versions of Asterisk. I consider this problem to be very minor at the moment and so this should really go into trunk only.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
More information about the asterisk-bugs
mailing list