[asterisk-dev] Resource leak in SIP/TCP

Steve Davies davies147 at gmail.com
Mon Jan 16 04:04:03 CST 2012


On 13 January 2012 18:21, Steve Davies <davies147 at gmail.com> wrote:
> Hi,
>
> I am pretty sure of the following, but am not a pthread expert... The
> code is the same in 1.6.2 and 1.8.8.1, I've not checked version 10
> yet.
>
> There is a thread resource leak in SIP-over-TCP or TLS. If a TCP
> connection fails, then the thread is torn down, but as the thread is
> created 'joinable' in sip_prepare_socket(), and nothing ever
> pthread_join()'s to it, we leak about 240Kb and 2x mmap maps.
>
> Question - Should the thread be created detached? Or should the thread
> be pthread_join()'ed in sip_tcptls_client_args_destructor(), as the
> object being destroyed seems to hold a reference to the thread.
>
> I have not checked whether sip_tcptls_client_args_destructor runs in
> the thread or outside it, which may answer the question.
>

Issue #ASTERISK-19203 - I fixed this locally by creating the thread detached.

Regards,
Steve



More information about the asterisk-dev mailing list