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

rmudgett reviewboard at asterisk.org
Thu Feb 9 15:46:24 CST 2012



> On Feb. 9, 2012, 3:42 p.m., Mark Michelson wrote:
> > /branches/1.8/channels/chan_sip.c, lines 30514-30528
> > <https://reviewboard.asterisk.org/r/1714/diff/1/?file=23886#file23886line30514>
> >
> >     Let me know if I'm right or wrong here. Is this code block here to make sure the module doesn't get unloaded while the threads in the threadt container are still running?

Yes. That is the idea.


- rmudgett


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


On Feb. 3, 2012, 5:05 p.m., rmudgett wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1714/
> -----------------------------------------------------------
> 
> (Updated Feb. 3, 2012, 5:05 p.m.)
> 
> 
> 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/20120209/d99d4646/attachment.htm>


More information about the asterisk-dev mailing list