Summary:ASTERISK-19203: Resource leak in SIP/TCP
Reporter:Steve Davies (one47)Labels:
Date Opened:2012-01-16 04:01:45.000-0600Date Closed:2012-02-24 12:26:19.000-0600
Versions: 10.0.0 Frequency of
Environment:pthreadAttachments:( 0) sip_detached_thread.patch
Description:There is a thread resource leak in SIP-over-TCP or TLS. If a TCP connection fails (eg. connection refused), then the thread is torn down, but as the thread is created 'joinable' in chan_sip.c:sip_prepare_socket(), and nothing ever pthread_join()'s to it, we leak about 240Kb and 2x mmap maps.

I have patched this locally by changing the thread to be created detached, which seems to work.
Comments:By: Steve Davies (one47) 2012-01-16 04:03:04.552-0600

Patch against 10.0 trunk attached. Same change applies to 1.6.2 and 1.8.8.

By: Richard Mudgett (rmudgett) 2012-02-03 17:06:44.803-0600

I found a couple minor things with the original patch [^sip_detached_thread.patch].
I posted an updated patch on https://reviewboard.asterisk.org/r/1714/

The patch will currently apply to Asterisk v10.