tcmalloc

segfault on tcmalloc ReleaseToCentralCache


We met with segfault dump often when the traffic comes in very high. Not sure what's the problem here now?

Anyone has the experience to share with us?

(gdb) bt

#0 ... in tcmalloc::ThreadCache::ReleaseToCentralCache(tcmalloc::ThreadCache::FreeList*, unsigned long, int) () from /usr/lib64/libtcmalloc.so
#1 ... in tcmalloc::ThreadCache::ListTooLong(tcmalloc::ThreadCache::FreeList*, unsigned  long) () from /usr/lib64/libtcmalloc.so
#2 ... in tc_delete () from /usr/lib64/libtcmalloc.so
#3 ... in boost::detail::sp_counted_impl_p<OutputObject>::dispose() () at /opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/bits/unique_ptr.h:67

Thanks,


Solution

  • Most likely you have memory corruption in your program. Double free, for instance. You're saying that segfault is coming when load is high, so it's most probably race condition.

    We had this problem when we used thread-unsafe object concurrently (via Singleton pattern) and thus having various problems with memory threating. You will probably find out where your problem is by going up in stacktrace and examining every frame for such bugs. It worked for me - that segfault was caused by std::string destructor, where std::string was part of thread-unsafe object structure.