[asterisk-dev] [Code Review] Resource leak in SIP/TCP
rmudgett
reviewboard at asterisk.org
Mon Feb 13 13:33:43 CST 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1714/
-----------------------------------------------------------
(Updated Feb. 13, 2012, 1:33 p.m.)
Review request for Asterisk Developers.
Changes
-------
Change the wait for TCP/TLS worker threads to die loop hack to only need the magic number once.
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 (updated)
-----
/branches/1.8/channels/chan_sip.c 355008
/branches/1.8/channels/sip/include/sip.h 355008
/branches/1.8/include/asterisk/tcptls.h 355008
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/20120213/6bb7ef7d/attachment.htm>
More information about the asterisk-dev
mailing list