[asterisk-dev] [Code Review] Resource leak in SIP/TCP

rmudgett reviewboard at asterisk.org
Fri Feb 3 17:05:08 CST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1714/
-----------------------------------------------------------

Review request for Asterisk Developers.


Summary
-------

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.

The issue description copied above was not quite true.  There was a joiner, but if the thread
died on its own, it removed the ability to join it.  Also the thread may or may not have been
created joinable.

* _sip_tcp_helper_thread() only needs one parameter since the pvt parameter is only passed in as NULL and never used.


This addresses bug ASTERISK-19203.
    https://issues.asterisk.org/jira/browse/ASTERISK-19203


Diffs
-----

  /branches/1.8/channels/chan_sip.c 354045 
  /branches/1.8/channels/sip/include/sip.h 354045 
  /branches/1.8/include/asterisk/tcptls.h 354045 

Diff: https://reviewboard.asterisk.org/r/1714/diff


Testing
-------

I don't have a setup to test the patch.  However, by not creating the thread as
joinable fixed the issue for the reporter in his original patch.

Otherwise it compiles. :)


Thanks,

rmudgett

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120203/1e6c2c1c/attachment.htm>


More information about the asterisk-dev mailing list