[asterisk-bugs] [JIRA] (ASTERISK-20795) Taskprocessors can leak memory

Rusty Newton (JIRA) noreply at issues.asterisk.org
Thu Dec 13 17:43:45 CST 2012


Rusty Newton created ASTERISK-20795:
---------------------------------------

             Summary: Taskprocessors can leak memory
                 Key: ASTERISK-20795
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-20795
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Core/General
    Affects Versions: SVN, 1.8.19.0, 10.11.0, 11.1.0
            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 is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira



More information about the asterisk-bugs mailing list