Lazy TLS initialization vs. TCMalloc.

Florian Weimer fweimer@redhat.com
Tue Mar 22 20:50:00 GMT 2016


On 03/22/2016 08:58 PM, Carlos O'Donell wrote:
> I was asked to comment on Ceph/TCMalloc deadlock problems
> which appeared to be glibc-related. Given that I stood up
> and represented the community I'm posting what I wrote
> here for posterity:
> 
> http://tracker.ceph.com/issues/13522#note-23
> 
> The basic problem is that lazy TLS initialization has
> unknown requirements on the interposing malloc and TCMalloc
> gets it wrong.
> 
> I hope that we can find somebody to fix the issue and that
> consensus remains that dlopen should allocate up front to
> avoid the issues with lazy initialization.

This bug is potentially related:

  https://sourceware.org/bugzilla/show_bug.cgi?id=18524

For TLS-with-destructor access in C++, we call calloc without error
checking.  There is no good way we can report the error.  As far as I
know, GCC does not declare the number of thread-local variables with
destructors, and a conservative estimate would be fairly large (objects
can be as small as one byte, and all these objects might need an 8-byte
destructor pointer).

Florian



More information about the Libc-alpha mailing list