[SERVER-11650] Unittests freeing unallocated thread specific pointer in debug mode Created: 09/Nov/13  Updated: 11/Jul/16  Resolved: 11/Nov/13

Status: Closed
Project: Core Server
Component/s: Build
Affects Version/s: None
Fix Version/s: 2.5.4

Type: Bug Priority: Major - P3
Reporter: Shaun Verch Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-13624 mongorestore causes mongod crashing Closed
Backwards Compatibility: Fully Compatible
Operating System: OS X
Participants:

 Description   

I don't know what's causing this, but here's the output I get:

$ build/darwin/dd/mongo/hash_test
2013-11-09T11:32:24.062-0500 going to run suite: GeoHash
2013-11-09T11:32:24.063-0500 	 going to run test: MakeZeroHash
2013-11-09T11:32:24.063-0500 	 going to run test: MakeRandomValidHashes
2013-11-09T11:32:24.063-0500 	 going to run test: MakeTooLongHash
2013-11-09T11:32:24.063-0500 	 going to run test: MakeOddHash
2013-11-09T11:32:24.063-0500 	 DONE running tests
2013-11-09T11:32:24.063-0500 **************************************************
2013-11-09T11:32:24.063-0500 GeoHash                        | tests:    4 | fails:    0 | assert calls:          2 | time secs:  0.000
2013-11-09T11:32:24.063-0500 TOTALS                         | tests:    4 | fails:    0 | assert calls:          2 | time secs:  0.000
2013-11-09T11:32:24.063-0500 SUCCESS - All tests in all suites passed
hash_test(75340) malloc: *** error for object 0x1010843e0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

Stack trace:

$ gdb build/darwin/dd/mongo/hash_test
GNU gdb 6.3.50-20050815 (Apple version gdb-1822) (Sun Aug  5 03:00:42 UTC 2012)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ... done
 
(gdb) r
Starting program: <path>/build/darwin/dd/mongo/hash_test
Reading symbols for shared libraries ++.............................. done
2013-11-09T11:33:20.667-0500 going to run suite: GeoHash
2013-11-09T11:33:20.668-0500 	 going to run test: MakeZeroHash
2013-11-09T11:33:20.668-0500 	 going to run test: MakeRandomValidHashes
2013-11-09T11:33:20.668-0500 	 going to run test: MakeTooLongHash
2013-11-09T11:33:20.668-0500 	 going to run test: MakeOddHash
2013-11-09T11:33:20.668-0500 	 DONE running tests
2013-11-09T11:33:20.669-0500 **************************************************
2013-11-09T11:33:20.669-0500 GeoHash                        | tests:    4 | fails:    0 | assert calls:          2 | time secs:  0.000
2013-11-09T11:33:20.669-0500 TOTALS                         | tests:    4 | fails:    0 | assert calls:          2 | time secs:  0.000
2013-11-09T11:33:20.669-0500 SUCCESS - All tests in all suites passed
hash_test(75371) malloc: *** error for object 0x1010843e0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
 
Program received signal SIGABRT, Aborted.
0x00007fff997dbd46 in __kill ()
(gdb) bt
#0  0x00007fff997dbd46 in __kill ()
#1  0x00007fff8e42cf83 in abort ()
#2  0x00007fff8e400989 in free ()
#3  0x00000001000b4c1a in boost::thread_specific_ptr<std::string>::delete_data::operator() (this=0x100605640, data=0x1010843e0) at tss.hpp:42
#4  0x0000000100130ecd in boost::detail::set_tss_data (key=0x10020d6f0, func=@0x7fff5fbff908, tss_data=0x0, cleanup_existing=true) at thread.cpp:586
#5  0x00000001000b5008 in boost::thread_specific_ptr<std::string>::~thread_specific_ptr (this=0x10020d6f0) at tss.hpp:79
#6  0x00000001000b485b in __tcf_1 (unnamed_arg=0x0) at thread_name.cpp:26
#7  0x00007fff8e42e521 in __cxa_finalize ()
#8  0x00007fff8e43068b in exit ()
#9  0x000000010000121b in start ()
(gdb)



 Comments   
Comment by auto [ 11/Nov/13 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@10gen.com'}

Message: SERVER-11650 Disable debugallocation on darwin due to gperftools issue 581
Branch: master
https://github.com/mongodb/mongo/commit/2b665282f23903c963f4c0f9c0c6cc355246722a

Comment by Andrew Morrow (Inactive) [ 09/Nov/13 ]

I believe this is due to https://code.google.com/p/gperftools/issues/detail?id=581.

Fix is, sadly, to disable gperftools debug allocator on OS X until gperftools has a fix.

This doesn't seem to trigger for users using XCode 5 and therefore clang, but I think that is a happy accident.

Hopefully we can upgrade to a newer gperftools early in 2.7 that will have a fix for this issue.

Comment by Shaun Verch [ 09/Nov/13 ]

SCons configure step:

$ scons --dd -j 8 --mute all
scons: Reading SConscript files ...
scons version: 2.3.0
python version: 2 7 2 'final' 0
Checking whether the C++ compiler worksyes
Checking whether the C compiler worksyes
Checking if C++ compiler "g++" is GCC... yes
Checking if C compiler "gcc" is GCC... yes
Checking if C compiler supports -Wno-unused-local-typedefs... no
Checking if C compiler supports -Wno-unused-function... yes
Checking if C compiler supports -Wno-unused-private-field... no
Checking if C compiler supports -Wno-mismatched-tags... no
Checking if C compiler supports -Wno-deprecated-declarations... yes
Checking if C compiler supports -Wno-tautological-constant-out-of-range-compare... no
Checking if C compiler supports -Wno-unused-const-variable... no
Checking if C compiler supports -mmacosx-version-min=10.6... yes
Checking for __thread... no
Checking for C header file unistd.h... yes
Checking whether clock_gettime is declared... no
Checking for C++ header file execinfo.h... yes
Checking whether backtrace is declared... yes
Checking whether backtrace_symbols is declared... yes
Checking whether backtrace_symbols_fd is declared... yes
Checking for C library pcap... yes
Checking if __malloc_hook is declared volatile... no
scons: done reading SConscript files.
scons: Building targets ...
generate_buildinfo(["build/darwin/dd/buildinfo.cpp"], ['\n#include <string>\n#include <boost/version.hpp>\n\n#include "mongo/util/version.h"\n\nnamespace mongo {\n    const char * gitVersion() { return "%(git_version)s"; }\n    const char * compiledJSEngine() { return "%(js_engine)s"; }\n    const char * allocator() { return "%(allocator)s"; }\n    const char * loaderFlags() { return "%(loader_flags)s"; }\n    const char * compilerFlags() { return "%(compiler_flags)s"; }\n    std::string sysInfo() { return "%(sys_info)s BOOST_LIB_VERSION=" BOOST_LIB_VERSION ; }\n}  // namespace mongo\n'])

Comment by Andrew Morrow (Inactive) [ 09/Nov/13 ]

Can you please also post the output of your "configure" step?

Comment by Shaun Verch [ 09/Nov/13 ]

$ uname -a
Darwin sv.local 12.5.0 Darwin Kernel Version 12.5.0: Mon Jul 29 16:33:49 PDT 2013; root:xnu-2050.48.11~1/RELEASE_X86_64 x86_64
$ xcodebuild -version
Xcode 4.6
Build version 4H127

Comment by Shaun Verch [ 09/Nov/13 ]

scons --jobs 8 --dd --mute build/darwin/dd/mongo/hash_test

Just confirmed that this only happens with the "--dd" flag. Will get the other info shortly.

Comment by Andrew Morrow (Inactive) [ 09/Nov/13 ]

sverch Can I get the exact SCons invocation you used, and your Darwin and XCode info?

Generated at Thu Feb 08 03:26:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.