Metaswitch/sprout — pull request #160 by telecore-ivan (2013-07-18 17:19:58+00:00)
Title: Add mutex in FakeLogger to protect _lastlog string

This fix a crash in the StatefulEdgeProxyTest.TestPreferredAssertedIdentities unit test

[ RUN ] StatefulEdgeProxyTest.TestPreferredAssertedIdentities
*** glibc detected *** /home/ubuntu/sprout/build/bin/sprout_test: double free or corruption (!prev): 0x0000000001fa86a0 ***

Core was generated by `/home/ubuntu/sprout/build/bin/sprout_test --gtest_output=xml:/home/ubuntu/sprou'.
Program terminated with signal 6, Aborted.
#0 0x00002abd3d14b425 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
Traceback (most recent call last):
File "/usr/lib/debug/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16-gdb.py", line 62, in
from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named libstdcxx.v6.printers
(gdb) bt
#0 0x00002abd3d14b425 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00002abd3d14eb8b in __GI_abort () at abort.c:91
#2 0x00002abd3c9b969d in __gnu_cxx::__verbose_terminate_handler () at ../../../../src/libstdc++-v3/libsupc++/vterminate.cc:95
#3 0x00002abd3c9b7846 in __cxxabiv1::__terminate (handler=) at ../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:40
#4 0x00002abd3c9b7873 in std::terminate () at ../../../../src/libstdc++-v3/libsupc++/eh_terminate.cc:50
#5 0x00002abd3c9b796e in __cxxabiv1::__cxa_throw (obj=0x2abd50009390, tinfo=, dest=)
at ../../../../src/libstdc++-v3/libsupc++/eh_throw.cc:83
#6 0x000000000058b799 in test_main_handle_signal (xiSigNum=11) at ut/test_main.cpp:124
#7
#8 __memcpy_ssse3_back () at ../sysdeps/x86_64/multiarch/memcpy-ssse3-back.S:1579
#9 0x00002abd3c9a1842 in copy (__n=, __s2=0x4771f18 "hDR8nN+b/r\205",
__s1=0x2abd50000a48 "Verbose pjsip: fake_tcplis:50 FAKE_TCP listener testnode:5060: got incoming FAKE_TCP connection from 1.2.3.4:49152\nVerbose pjsip: fake_tcps0x1f7 FAKE_TCP server transport created\nDebug pjsip: sip_endp"...)
at /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/char_traits.h:273
#10 _M_copy (__n=, __s=0x4771f18 "hDR8nN+b/r\205",
__d=0x2abd50000a48 "Verbose pjsip: fake_tcplis:50 FAKE_TCP listener testnode:5060: got incoming FAKE_TCP connection from 1.2.3.4:49152\nVerbose pjsip: fake_tcps0x1f7 FAKE_TCP server transport created\nDebug pjsip: sip_endp"...)
at /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.h:354
#11 std::string::_Rep::_M_clone (this=0x4771f00, __alloc=..., __res=)
at /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:633
#12 0x00002abd3c9a18e0 in reserve (__res=, this=0x2058f70)
at /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:512
#13 std::string::reserve (this=0x2058f70, __res=)
at /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:503
#14 0x00002abd3c9a1e0d in std::string::append (this=0x2058f70, __str="Debug statistic.cpp:95: Send new value for statistic client_count, size 1\n")
at /build/buildd/gcc-4.6-4.6.3/build/x86_64-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:334
#15 0x0000000000597c73 in FakeLogger::write (this=0x2058f20,
data=0x2abd3f5d1d10 "Debug statistic.cpp:95: Send new value for statistic client_count, size 1\n") at ut/fakelogger.cpp:78
#16 0x0000000000556e2e in Log::write (level=5, module=0x801987 "\r\004", line_number=95, fmt=0x801a10 "\326\016") at log.cpp:113
#17 0x000000000055afde in Statistic::reporter (this=0x1ec2b28) at statistic.cpp:95
#18 0x000000000055b904 in Statistic::reporter_thread (p=0x1ec2b28) at statistic.cpp:144
#19 0x00002abd3c6ece9a in start_thread (arg=0x2abd3f5d4700) at pthread_create.c:308
#20 0x00002abd3d208ccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#21 0x0000000000000000 in ?? ()