Title: segfault on tcmalloc ReleaseToCentralCache
Tags: tcmalloc
Question: 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 tcmallo75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ThreadCach75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ReleaseToCentralCache(tcmallo75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ThreadCach75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0FreeList*, unsigned long, int) () from /usr/lib64/libtcmalloc.so
#1 ... in tcmallo75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ThreadCach75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ListTooLong(tcmallo75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ThreadCach75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0FreeList*, unsigned  long) () from /usr/lib64/libtcmalloc.so
#2 ... in tc_delete () from /usr/lib64/libtcmalloc.so
#3 ... in boost75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0tail75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0sp_counted_impl_p<OutputObject&gt;75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0ispose() () at /opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/bits/unique_ptr.h:67
Thanks,

Here is the accepted answer: 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 st75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0string destructor, where st75b5:f2c1:f5d7:b954:8dc3:cee9:baf:a8c0string was part of thread-unsafe object structure.
Comment for this answer: If there is one, I don't know. I can just suggest you to analyze each frame. Like, if you see string destructor in trace - then you need to go upper and look where this string comes from, who owns this string, what scope is this string of, and so on. Eventually you should be able to stalk into some thread-unsafe object or code.
Comment for this answer: as you have mentioned the "going up the stackstrace", do you have any hints/tips on how to do that? The question is not related with the original issue.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2015:00:12/08/15', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<tcmalloc>', 'Title': 'segfault on tcmalloc ReleaseToCentralCache', 'ViewCount': 4518, 'id': 34146880, 'user_AboutMe': '', 'user_AccountId': 1100388.0, 'user_DisplayName': 'wenxzhen', 'user_Reputation': 75.0, 'user_Views': 30.0, 'user_id': 1092920.0}}