Closed bobinson closed 5 years ago
*** Error in `witness_node': double free or corruption (out): 0x0000000006f13eb0 ***g
======= Backtrace: =========g
/lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fd1acc647e5]g
/lib/x86_64-linux-gnu/libc.so.6(+0x8037a)[0x7fd1acc6d37a]g
/lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fd1acc7153c]g
witness_node(_ZNKSt14default_deleteIN8graphene5chain8databaseEEclEPS2_+0x2a)[0x401928a]g
witness_node(_ZNSt10unique_ptrIN8graphene5chain8databaseESt14default_deleteIS2_EED1Ev+0x47)[0x401588f]g
witness_node(_ZN9sidechain21sidechain_net_managerD1Ev+0x1c)[0x40133fa]g
witness_node(_ZN8graphene14witness_plugin14witness_pluginD1Ev+0xb8)[0x470fdb6]g
witness_node(_ZN9__gnu_cxx13new_allocatorIN8graphene14witness_plugin14witness_pluginEE7destroyIS3_EEvPT_+0x23)[0x403ac45]g
witness_node(_ZNSt16allocator_traitsISaIN8graphene14witness_plugin14witness_pluginEEE7destroyIS2_EEvRS3_PT_+0x23)[0x403a26f]g
witness_node(_ZNSt23_Sp_counted_ptr_inplaceIN8graphene14witness_plugin14witness_pluginESaIS2_ELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv+0x37)[0x40390dd]g
witness_node(_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv+0x42)[0x401869e]g
witness_node(_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EED1Ev+0x27)[0x4014bdd]g
witness_node(_ZNSt12__shared_ptrIN8graphene3app15abstract_pluginELN9__gnu_cxx12_Lock_policyE2EED1Ev+0x1c)[0x4015be2]g
witness_node(_ZNSt10shared_ptrIN8graphene3app15abstract_pluginEED1Ev+0x18)[0x4015bfe]g
witness_node(_ZNSt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt10shared_ptrIN8graphene3app15abstract_pluginEEED1Ev+0x1c)[0x40c1244]g
witness_node(_ZN9__gnu_cxx13new_allocatorISt13_Rb_tree_nodeISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt10shared_ptrIN8graphene3app15abstract_pluginEEEEE7destroyISF_EEvPT_+0x1c)[0x40c1270]g
witness_node(_ZNSt16allocator_traitsISaISt13_Rb_tree_nodeISt4pairIKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt10shared_ptrIN8graphene3app15abstract_pluginEEEEEE7destroyISE_EEvRSG_PT_+0x23)[0x40a19ad]g
witness_node(_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_St10shared_ptrIN8graphene3app15abstract_pluginEEESt10_Select1stISD_ESt4lessIS5_ESaISD_EE15_M_destroy_nodeEPSt13_Rb_tree_nodeISD_E+0x37)[0x408cc43]g
witness_node(_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_St10shared_ptrIN8graphene3app15abstract_pluginEEESt10_Select1stISD_ESt4lessIS5_ESaISD_EE12_M_drop_nodeEPSt13_Rb_tree_nodeISD_E+0x23)[0x407b0bd]g
witness_node(_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_St10shared_ptrIN8graphene3app15abstract_pluginEEESt10_Select1stISD_ESt4lessIS5_ESaISD_EE8_M_eraseEPSt13_Rb_tree_nodeISD_E+0x58)[0x406faca]g
witness_node(_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_St10shared_ptrIN8graphene3app15abstract_pluginEEESt10_Select1stISD_ESt4lessIS5_ESaISD_EE8_M_eraseEPSt13_Rb_tree_nodeISD_E+0x35)[0x406faa7]g
witness_node(_ZNSt8_Rb_treeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt4pairIKS5_St10shared_ptrIN8graphene3app15abstract_pluginEEESt10_Select1stISD_ESt4lessIS5_ESaISD_EED1Ev+0x2a)[0x4066370]g
witness_node(_ZNSt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESt10shared_ptrIN8graphene3app15abstract_pluginEESt4lessIS5_ESaISt4pairIKS5_SA_EEED1Ev+0x18)[0x40510e0]g
witness_node(_ZN8graphene3app6detail16application_implD1Ev+0x89)[0x405133b]g
witness_node(_ZN8graphene3app6detail16application_implD0Ev+0x18)[0x4051402]g
witness_node(_ZNSt15_Sp_counted_ptrIPN8graphene3app6detail16application_implELN9__gnu_cxx12_Lock_policyE2EE10_M_disposeEv+0x40)[0x42ed38a]g
witness_node(_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv+0x42)[0x401869e]g
witness_node(_ZNSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EED1Ev+0x27)[0x4014bdd]g
witness_node(_ZNSt12__shared_ptrIN8graphene3app6detail16application_implELN9__gnu_cxx12_Lock_policyE2EED1Ev+0x1c)[0x406070a]g
witness_node(_ZNSt10shared_ptrIN8graphene3app6detail16application_implEED1Ev+0x18)[0x4060726]g
witness_node(_ZN8graphene3app11applicationD1Ev+0xf1)[0x403f14d]g
witness_node(main+0x1e26)[0x400e8f4]g
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fd1acc0d830]g
witness_node(_start+0x29)[0x400c239]g
======= Memory map: ========g
00400000-05ebb000 r-xp 00000000 fc:00 7616205 /usr/local/bin/witness_nodeg
060bb000-060bc000 r--p 05abb000 fc:00 7616205 /usr/local/bin/witness_nodeg
060bc000-060d0000 rw-p 05abc000 fc:00 7616205 /usr/local/bin/witness_nodeg
060d0000-060d9000 rw-p 00000000 00:00 0 g
06ee0000-070ab000 rw-p 00000000 00:00 0 [heap]g
7fd178000000-7fd178021000 rw-p 00000000 00:00 0 g
7fd178021000-7fd17c000000 ---p 00000000 00:00 0 g
7fd17c000000-7fd17c021000 rw-p 00000000 00:00 0 g
7fd17c021000-7fd180000000 ---p 00000000 00:00 0 g
7fd180000000-7fd180021000 rw-p 00000000 00:00 0 g
7fd180021000-7fd184000000 ---p 00000000 00:00 0 g
7fd184000000-7fd184021000 rw-p 00000000 00:00 0 g
7fd184021000-7fd188000000 ---p 00000000 00:00 0 g
7fd188000000-7fd188021000 rw-p 00000000 00:00 0 g
7fd188021000-7fd18c000000 ---p 00000000 00:00 0 g
7fd18c000000-7fd18c021000 rw-p 00000000 00:00 0 g
7fd18c021000-7fd190000000 ---p 00000000 00:00 0 g
7fd190000000-7fd190021000 rw-p 00000000 00:00 0 g
7fd190021000-7fd194000000 ---p 00000000 00:00 0 g
7fd194000000-7fd194021000 rw-p 00000000 00:00 0 g
7fd194021000-7fd198000000 ---p 00000000 00:00 0 g
7fd19adfe000-7fd19adff000 ---p 00000000 00:00 0 g
7fd19adff000-7fd19affe000 rw-p 00000000 00:00 0 g
7fd19affe000-7fd19afff000 ---p 00000000 00:00 0 g
7fd19afff000-7fd19b7ff000 rw-p 00000000 00:00 0 g
7fd19b7ff000-7fd19b800000 ---p 00000000 00:00 0 g
7fd19b800000-7fd19c000000 rw-p 00000000 00:00 0 g
7fd19c000000-7fd19c021000 rw-p 00000000 00:00 0 g
7fd19c021000-7fd1a0000000 ---p 00000000 00:00 0 g
7fd1a0000000-7fd1a0021000 rw-p 00000000 00:00 0 g
7fd1a0021000-7fd1a4000000 ---p 00000000 00:00 0 g
7fd1a4000000-7fd1a4021000 rw-p 00000000 00:00 0 g
7fd1a4021000-7fd1a8000000 ---p 00000000 00:00 0 g
7fd1a8186000-7fd1a8187000 ---p 00000000 00:00 0 g
7fd1a8187000-7fd1a8987000 rw-p 00000000 00:00 0 g
7fd1a8987000-7fd1a8988000 ---p 00000000 00:00 0 g
7fd1a8988000-7fd1a9188000 rw-p 00000000 00:00 0 g
7fd1a9188000-7fd1a9189000 ---p 00000000 00:00 0 g
7fd1a9189000-7fd1a9989000 rw-p 00000000 00:00 0 g
7fd1a9989000-7fd1a998a000 ---p 00000000 00:00 0 g
7fd1a998a000-7fd1aa18a000 rw-p 00000000 00:00 0 g
7fd1aa18a000-7fd1aa18b000 ---p 00000000 00:00 0 g
7fd1aa18b000-7fd1aa98b000 rw-p 00000000 00:00 0 g
7fd1aa98b000-7fd1aa98c000 ---p 00000000 00:00 0 g
7fd1aa98c000-7fd1ab18c000 rw-p 00000000 00:00 0 g
7fd1ab18c000-7fd1ab18d000 ---p 00000000 00:00 0 g
7fd1ab18d000-7fd1ab98d000 rw-p 00000000 00:00 0 g
7fd1ab98d000-7fd1ab98e000 ---p 00000000 00:00 0 g
7fd1ab98e000-7fd1ac18e000 rw-p 00000000 00:00 0 g
7fd1ac18e000-7fd1ac18f000 ---p 00000000 00:00 0 g
7fd1ac18f000-7fd1ac98f000 rw-p 00000000 00:00 0 g
7fd1ac98f000-7fd1ac9ec000 r-xp 00000000 fc:00 7615201 /usr/lib/x86_64-linux-gnu/libsodium.so.18.0.1g
7fd1ac9ec000-7fd1acbeb000 ---p 0005d000 fc:00 7615201 /usr/lib/x86_64-linux-gnu/libsodium.so.18.0.1g
7fd1acbeb000-7fd1acbec000 r--p 0005c000 fc:00 7615201 /usr/lib/x86_64-linux-gnu/libsodium.so.18.0.1g
7fd1acbec000-7fd1acbed000 rw-p 0005d000 fc:00 7615201 /usr/lib/x86_64-linux-gnu/libsodium.so.18.0.1g
7fd1acbed000-7fd1acdad000 r-xp 00000000 fc:00 2097653 /lib/x86_64-linux-gnu/libc-2.23.sog
7fd1acdad000-7fd1acfad000 ---p 001c0000 fc:00 2097653 /lib/x86_64-linux-gnu/libc-2.23.sog
7fd1acfad000-7fd1acfb1000 r--p 001c0000 fc:00 2097653 /lib/x86_64-linux-gnu/libc-2.23.sog
7fd1acfb1000-7fd1acfb3000 rw-p 001c4000 fc:00 2097653 /lib/x86_64-linux-gnu/libc-2.23.sog
7fd1acfb3000-7fd1acfb7000 rw-p 00000000 00:00 0 g
7fd1acfb7000-7fd1acfcd000 r-xp 00000000 fc:00 2097679 /lib/x86_64-linux-gnu/libgcc_s.so.1g
7fd1acfcd000-7fd1ad1cc000 ---p 00016000 fc:00 2097679 /lib/x86_64-linux-gnu/libgcc_s.so.1g
7fd1ad1cc000-7fd1ad1cd000 rw-p 00015000 fc:00 2097679 /lib/x86_64-linux-gnu/libgcc_s.so.1g
7fd1ad1cd000-7fd1ad2d5000 r-xp 00000000 fc:00 2097694 /lib/x86_64-linux-gnu/libm-2.23.sog
7fd1ad2d5000-7fd1ad4d4000 ---p 00108000 fc:00 2097694 /lib/x86_64-linux-gnu/libm-2.23.sog
7fd1ad4d4000-7fd1ad4d5000 r--p 00107000 fc:00 2097694 /lib/x86_64-linux-gnu/libm-2.23.sog
7fd1ad4d5000-7fd1ad4d6000 rw-p 00108000 fc:00 2097694 /lib/x86_64-linux-gnu/libm-2.23.sog
7fd1ad4d6000-7fd1ad648000 r-xp 00000000 fc:00 7604593 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21g
7fd1ad648000-7fd1ad848000 ---p 00172000 fc:00 7604593 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21g
7fd1ad848000-7fd1ad852000 r--p 00172000 fc:00 7604593 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21g
7fd1ad852000-7fd1ad854000 rw-p 0017c000 fc:00 7604593 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21g
7fd1ad854000-7fd1ad858000 rw-p 00000000 00:00 0 g
7fd1ad858000-7fd1ad85f000 r-xp 00000000 fc:00 2097746 /lib/x86_64-linux-gnu/librt-2.23.sog
7fd1ad85f000-7fd1ada5e000 ---p 00007000 fc:00 2097746 /lib/x86_64-linux-gnu/librt-2.23.sog
7fd1ada5e000-7fd1ada5f000 r--p 00006000 fc:00 2097746 /lib/x86_64-linux-gnu/librt-2.23.sog
7fd1ada5f000-7fd1ada60000 rw-p 00007000 fc:00 2097746 /lib/x86_64-linux-gnu/librt-2.23.sog
7fd1ada60000-7fd1ada63000 r-xp 00000000 fc:00 2097667 /lib/x86_64-linux-gnu/libdl-2.23.sog
7fd1ada63000-7fd1adc62000 ---p 00003000 fc:00 2097667 /lib/x86_64-linux-gnu/libdl-2.23.sog
7fd1adc62000-7fd1adc63000 r--p 00002000 fc:00 2097667 /lib/x86_64-linux-gnu/libdl-2.23.sog
7fd1adc63000-7fd1adc64000 rw-p 00003000 fc:00 2097667 /lib/x86_64-linux-gnu/libdl-2.23.sog
7fd1adc64000-7fd1adc7c000 r-xp 00000000 fc:00 2097740 /lib/x86_64-linux-gnu/libpthread-2.23.sog
7fd1adc7c000-7fd1ade7b000 ---p 00018000 fc:00 2097740 /lib/x86_64-linux-gnu/libpthread-2.23.sog
7fd1ade7b000-7fd1ade7c000 r--p 00017000 fc:00 2097740 /lib/x86_64-linux-gnu/libpthread-2.23.sog
7fd1ade7c000-7fd1ade7d000 rw-p 00018000 fc:00 2097740 /lib/x86_64-linux-gnu/libpthread-2.23.sog
7fd1ade7d000-7fd1ade81000 rw-p 00000000 00:00 0 g
7fd1ade81000-7fd1adee3000 r-xp 00000000 fc:00 7615218 /usr/lib/x86_64-linux-gnu/libzmq.so.5.0.0g
7fd1adee3000-7fd1ae0e2000 ---p 00062000 fc:00 7615218 /usr/lib/x86_64-linux-gnu/libzmq.so.5.0.0g
7fd1ae0e2000-7fd1ae0e6000 r--p 00061000 fc:00 7615218 /usr/lib/x86_64-linux-gnu/libzmq.so.5.0.0g
7fd1ae0e6000-7fd1ae0e7000 rw-p 00065000 fc:00 7615218 /usr/lib/x86_64-linux-gnu/libzmq.so.5.0.0g
7fd1ae0e7000-7fd1ae10d000 r-xp 00000000 fc:00 2097629 /lib/x86_64-linux-gnu/ld-2.23.sog
7fd1ae2fb000-7fd1ae303000 rw-p 00000000 00:00 0 g
7fd1ae30b000-7fd1ae30c000 rw-p 00000000 00:00 0 g
7fd1ae30c000-7fd1ae30d000 r--p 00025000 fc:00 2097629 /lib/x86_64-linux-gnu/ld-2.23.sog
7fd1ae30d000-7fd1ae30e000 rw-p 00026000 fc:00 2097629 /lib/x86_64-linux-gnu/ld-2.23.sog
7fd1ae30e000-7fd1ae30f000 rw-p 00000000 00:00 0 g
7ffe1ccab000-7ffe1cce5000 rw-p 00000000 00:00 0 [stack]g
7ffe1cd9d000-7ffe1cda0000 r--p 00000000 00:00 0 [vvar]g
7ffe1cda0000-7ffe1cda2000 r-xp 00000000 00:00 0 [vdso]g
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted (core dumped)
valgrind output
==23508== Invalid free() / delete / delete[] / realloc()
==23508== at 0x6D0824B: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23508== by 0x4019289: std::default_delete<graphene::chain::database>::operator()(graphene::chain::database*) const (unique_ptr.h:76)
==23508== by 0x401588E: std::unique_ptr<graphene::chain::database, std::default_delete<graphene::chain::database> >::~unique_ptr() (unique_ptr.h:236)
==23508== by 0x40133F9: sidechain::sidechain_net_manager::~sidechain_net_manager() (sidechain_net_manager.hpp:9)
==23508== by 0x470FDB5: graphene::witness_plugin::witness_plugin::~witness_plugin() (witness.hpp:52)
==23508== by 0x403AC44: void __gnu_cxx::new_allocator<graphene::witness_plugin::witness_plugin>::destroy<graphene::witness_plugin::witness_plugin>(graphene::witness_plugin::witness_plugin*) (new_allocator.h:124)
==23508== by 0x403A26E: void std::allocator_traits<std::allocator<graphene::witness_plugin::witness_plugin> >::destroy<graphene::witness_plugin::witness_plugin>(std::allocator<graphene::witness_plugin::witness_plugin>&, graphene::witness_plugin::witness_plugin*) (alloc_traits.h:542)
==23508== by 0x40390DC: std::_Sp_counted_ptr_inplace<graphene::witness_plugin::witness_plugin, std::allocator<graphene::witness_plugin::witness_plugin>, (__gnu_cxx::_Lock_policy)2>::_M_dispose() (shared_ptr_base.h:531)
==23508== by 0x401869D: std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() (shared_ptr_base.h:150)
==23508== by 0x4014BDC: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() (shared_ptr_base.h:659)
==23508== by 0x4015BE1: std::__shared_ptr<graphene::app::abstract_plugin, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() (shared_ptr_base.h:925)
==23508== by 0x4015BFD: std::shared_ptr<graphene::app::abstract_plugin>::~shared_ptr() (shared_ptr.h:93)
==23508== Address 0x86dd6e0 is 16 bytes inside a block of size 2,288 alloc'd
==23508== at 0x6D070EF: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==23508== by 0x410EE3C: __gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<graphene::chain::database, std::allocator<graphene::chain::database>, (__gnu_cxx::_Lock_policy)2> >::allocate(unsigned long, void const*) (new_allocator.h:104)
==23508== by 0x40E49BA: std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<graphene::chain::database, std::allocator<graphene::chain::database>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<graphene::chain::database, std::allocator<graphene::chain::database>, (__gnu_cxx::_Lock_policy)2> >&, unsigned long) (alloc_traits.h:491)
==23508== by 0x40C1031: std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<graphene::chain::database, std::allocator<graphene::chain::database>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<graphene::chain::database, std::allocator<graphene::chain::database>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<graphene::chain::database, std::allocator<graphene::chain::database>, (__gnu_cxx::_Lock_policy)2> >&) (allocated_ptr.h:102)
==23508== by 0x40A1832: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<graphene::chain::database, std::allocator<graphene::chain::database>>(std::_Sp_make_shared_tag, graphene::chain::database*, std::allocator<graphene::chain::database> const&) (shared_ptr_base.h:615)
==23508== by 0x408CA8E: std::__shared_ptr<graphene::chain::database, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<graphene::chain::database>>(std::_Sp_make_shared_tag, std::allocator<graphene::chain::database> const&) (shared_ptr_base.h:1097)
==23508== by 0x407AED5: std::shared_ptr<graphene::chain::database>::shared_ptr<std::allocator<graphene::chain::database>>(std::_Sp_make_shared_tag, std::allocator<graphene::chain::database> const&) (shared_ptr.h:319)
==23508== by 0x406F917: std::shared_ptr<graphene::chain::database> std::allocate_shared<graphene::chain::database, std::allocator<graphene::chain::database>>(std::allocator<graphene::chain::database> const&) (shared_ptr.h:620)
==23508== by 0x4066223: std::shared_ptr<graphene::chain::database> std::make_shared<graphene::chain::database>() (shared_ptr.h:636)
==23508== by 0x4051185: graphene::app::detail::application_impl::application_impl(graphene::app::application*) (application.cpp:297)
==23508== by 0x403EF8E: graphene::app::application::application() (application.cpp:937)
==23508== by 0x400CB10: main (main.cpp:69)
==23508==
terminate called after throwing an instance of 'zmq::error_t'
what(): Context was terminated
==23508==
==23508== Process terminating with default action of signal 6 (SIGABRT)
@bobinson As per the logs you had shared, you are trying to run a PeerPlays witness node without an active Bitcoin node. Hence this is expected.
An exception has been thrown due to the absence of a Bitcoin node. This called a database desctructor, which caused memory problems.
An exception has been thrown due to the absence of a Bitcoin node. This called a database desctructor, which caused memory problems.
Yes - the memory issue should be handled without causing a segmentation fault. The expected behaviour is showing a warning message and graceful shutdown as opposed to aborting the process.
@bobinson The "graceful shutdown" has been introduced pretty much the following day. Feel free to try with the latest version.
@pixelplex That sounds great. Can you share the link to the commit as well ?
The Bitcoin sidechain is now implemented via SONs and this issue is invalid.
Steps to reproduce:
Build and start the witness node on BTC-sidechain brach
logs: