[asterisk-dev] Deadlock in pthread_exit due to lazy binding with libgcc

Mark Michelson mmichelson at digium.com
Fri Jul 17 11:04:50 CDT 2015


On 07/15/2015 08:41 AM, Yousf Ateya wrote:
> Dear,
>
> I started to see a  strange deadlock in some asterisk nodes. For every 
> call, when calling pthread_exit from pbx_thread, the caller thread is 
> stuck inside pthread_exit.
>
> After a while, there will be tens-of-thousands of threads having the 
> same backtrace. After some googling, I found this happens because of 
> the default lazy linking of gcc linker.
>
> Related issue of stackoverflow: 
> http://stackoverflow.com/questions/11954527/dlopen-malloc-deadlock
>
> Tried to recompile asterisk using:
> export LDFLAGS=-Wl,-z,now
> ./configure && make && make install
>
> and this deadlock problem didn't happen again; the problem cause is 
> lazy binding with libgcc.
>
> Shall we add this option by default or add it in menuselect?

<snip>

>
> -- 
> Yousf Ateya,
> StarkBits
> www.starkbits.com <http://www.starkbits.com>
>

Thanks for this report. Based solely on the man page for ld(1), it 
sounds like load-time binding would, at most, cause module loading to 
take longer. Are there any other potential issues to making this change?

Mark Michelson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150717/6f347bac/attachment.html>


More information about the asterisk-dev mailing list