Robert Ramey writes:
I'm doubting that its the complexity of the class.
Sure, I agree. I was just trying to provide more info.
More likely that its the "last" class.
In the tests I am rrunning, each boost unit test is linked with its own main, so no two serialization tests run together. One of those tests fails.
Also it might be relevant that your using a multicore processor. The library presumes that everything before entering main and after leavnig main is run on a single thread. This seems like a reasonable presumption to me. You might look into this.
All of the individual tests are single threaded (although for build reasons they are linked with the mt libraries). That is, no test creates any additional threads.
You should also run the test with break points set on
~singleton(){ m_is_destroyed = true; // <<< break here }
To verify that this isn't getting called at an unexpected time.
I've done this and the destructor is called 15 times. It isn't obvious to me if this is unexpected (since this could be the base class of a hierarchy of singletons). Each time it is invoked on a different instance of this. Breakpoints and stack traces are at the end of this message. In the final call to ~singleton the object address is identical to the address of the ~extended_type_info object in the seg fault stack trace. Note that only the primary thread is ever created. Also, this unit test contains only a single top-level call to the serialization code. Of course, there are nested objects being serialized. Hope this helps. Let me know if there are more tests I can run. Thanks, -- Robert (gdb) list singleton.hpp:120 115 return get_instance(); 116 } 117 BOOST_DLLEXPORT static const T & get_const_instance(){ 118 return get_instance(); 119 } 120 BOOST_DLLEXPORT static bool is_destroyed(){ 121 return m_is_destroyed; 122 } 123 ~singleton(){ 124 m_is_destroyed = true; (gdb) b 124 Breakpoint 1 at 0x807ba0e: file /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp, line 124. (18 locations) (gdb) run The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /home/mecklen/s5w/trunk/core/common/src/test/SampleBinTest --catch_system_errors=no [Thread debugging using libthread_db enabled] Running 5 test cases... [New Thread 0xb73e16c0 (LWP 861)] *** No errors detected [Switching to Thread 0xb73e16c0 (LWP 861)] Breakpoint 1, ~singleton (this=0xb7f12294) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f12294) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7dc4c65 in ~extended_type_info_typeid (this=0xb7f12294) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7dc42c4 in __tcf_0 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f126cc) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f126cc) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7dd7a5b in ~extended_type_info_typeid (this=0xb7f126cc) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7dd64d8 in __tcf_0 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f15384) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f15384) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7e4c67b in ~extended_type_info_typeid (this=0xb7f15384) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7e4a3f0 in __tcf_0 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f15544) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f15544) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7e546cd in ~extended_type_info_typeid (this=0xb7f15544) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7e50986 in __tcf_0 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f12db0) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f12db0) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7e26d55 in ~extended_type_info_typeid (this=0xb7f12db0) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7e239e2 in __tcf_19 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f1245c) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f1245c) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7dc86d9 in ~extended_type_info_typeid (this=0xb7f1245c) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7dc4fec in __tcf_14 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f123c4) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f123c4) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7dc85ad in ~extended_type_info_typeid (this=0xb7f123c4) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7dc4fd8 in __tcf_0 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f1257c) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f1257c) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7dd3611 in ~extended_type_info_typeid (this=0xb7f1257c) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7dd265c in __tcf_0 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f12844) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f12844) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7de138d in ~extended_type_info_typeid (this=0xb7f12844) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7ddffde in __tcf_0 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f12cec) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f12cec) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7e26afd in ~extended_type_info_typeid (this=0xb7f12cec) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7e239ba in __tcf_0 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f157a4) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f157a4) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7e6daaf in ~extended_type_info_typeid (this=0xb7f157a4) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7e6c142 in __tcf_0 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f1541c) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f1541c) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7e4c7a7 in ~extended_type_info_typeid (this=0xb7f1541c) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7e4a404 in __tcf_14 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f12e54) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f12e54) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7e26e81 in ~extended_type_info_typeid (this=0xb7f12e54) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7e239f6 in __tcf_24 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0xb7f12d84) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0xb7f12d84) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0xb7e26c29 in ~extended_type_info_typeid (this=0xb7f12d84) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0xb7e239ce in __tcf_18 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb75933b1 in __cxa_finalize () from /lib/tls/i686/cmov/libc.so.6 #4 0xb7dc4023 in __do_global_dtors_aux () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #5 0xb7e93a4c in _fini () from /home/mecklen/s5w/trunk/core/common/src/libcommon.so #6 0xb7f7afcf in _dl_fini () from /lib/ld-linux.so.2 #7 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #8 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #9 0x08077ce1 in _start () (gdb) cont Continuing. Breakpoint 1, ~singleton (this=0x8097d90) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 124 m_is_destroyed = true; (gdb) where #0 ~singleton (this=0x8097d90) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:124 #1 0x0807fe2d in ~extended_type_info_typeid (this=0x8097d90) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #2 0x08077f02 in __tcf_7 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #3 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #4 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #5 0x08077ce1 in _start () (gdb) cont Continuing. Program received signal SIGSEGV, Segmentation fault. std::_Rb_tree_rebalance_for_erase (__z=0x8098fb8, __header=@0xb7afede0) at ../../../../src/libstdc++-v3/src/tree.cc:337 337 ../../../../src/libstdc++-v3/src/tree.cc: No such file or directory. in ../../../../src/libstdc++-v3/src/tree.cc (gdb) where #0 std::_Rb_tree_rebalance_for_erase (__z=0x8098fb8, __header=@0xb7afede0) at ../../../../src/libstdc++-v3/src/tree.cc:337 #1 0xb7accf93 in boost::serialization::extended_type_info::key_unregister () from /home/mecklen/work/boost-install/lib/boost-1_37/libboost_serialization-gcc42-mt-1_37.so.1.37.0 #2 0xb7acd0ef in boost::serialization::extended_type_info::~extended_type_info () from /home/mecklen/work/boost-install/lib/boost-1_37/libboost_serialization-gcc42-mt-1_37.so.1.37.0 #3 0xb7acda28 in boost::serialization::detail::extended_type_info_typeid_0::~extended_type_info_typeid_0 () from /home/mecklen/work/boost-install/lib/boost-1_37/libboost_serialization-gcc42-mt-1_37.so.1.37.0 #4 0x0807fe3e in ~extended_type_info_typeid (this=0x8097d90) at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/extended_type_info_typeid.hpp:80 #5 0x08077f02 in __tcf_7 () at /home/mecklen/work/boost-install/include/boost-1_37/boost/serialization/singleton.hpp:105 #6 0xb7593084 in exit () from /lib/tls/i686/cmov/libc.so.6 #7 0xb757b458 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6 #8 0x08077ce1 in _start () (gdb)