SEGV
problems started last night, crashes about 40 min after start. x64 i2pd version 2.51.0 (0.9.62) (branch openssl - 6ce2c30522a01534521354e83ee94f24d17bbf6e) Boost version 1.83.0 OpenSSL 3.2.1 30 Jan 2024
#0 0x00005c008864318f in std::__detail::_Hash_code_base<i2p::data::Tag<32ul>, std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer>, std::__detail::_Select1st, std::hash<i2p::data::Tag<32ul> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::_M_bucket_index (this=0x5c0088ba5890 <i2p::transport::transports+112>, __n=..., __bkt_count=20753) at /usr/include/c++/13.2.1/bits/hashtable_policy.h:1359
1359 { return _RangeHash{}(__n._M_hash_code, __bkt_count); }
#0 0x00005c008864318f in std::__detail::_Hash_code_base<i2p::data::Tag<32ul>, std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer>, std::__detail::_Select1st, std::hash<i2p::data::Tag<32ul> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::_M_bucket_index (this=0x5c0088ba5890 <i2p::transport::transports+112>, __n=..., __bkt_count=20753) at /usr/include/c++/13.2.1/bits/hashtable_policy.h:1359
No locals.
#1 0x00005c0088641319 in std::_Hashtable<i2p::data::Tag<32ul>, std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer>, std::allocator<std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer> >, std::__detail::_Select1st, std::equal_to<i2p::data::Tag<32ul> >, std::hash<i2p::data::Tag<32ul> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_bucket_index (this=0x5c0088ba5890 <i2p::transport::transports+112>, __n=...) at /usr/include/c++/13.2.1/bits/hashtable.h:793
No locals.
#2 0x00005c0088640e20 in std::_Hashtable<i2p::data::Tag<32ul>, std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer>, std::allocator<std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer> >, std::__detail::_Select1st, std::equal_to<i2p::data::Tag<32ul> >, std::hash<i2p::data::Tag<32ul> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_before_node (this=0x5c0088ba5890 <i2p::transport::transports+112>, __bkt=1404, __k=..., __code=131203317868794180) at /usr/include/c++/13.2.1/bits/hashtable.h:1949
__p = 0x74e61005ac00
__prev_p = 0x74e61003a260
#3 0x00005c008863e6ee in std::_Hashtable<i2p::data::Tag<32ul>, std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer>, std::allocator<std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer> >, std::__detail::_Select1st, std::equal_to<i2p::data::Tag<32ul> >, std::hash<i2p::data::Tag<32ul> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::_M_find_node (this=0x5c0088ba5890 <i2p::transport::transports+112>, __bkt=1404, __key=..., __c=131203317868794180) at /usr/include/c++/13.2.1/bits/hashtable.h:815
__before_n = 0x5c0088ba5890 <i2p::transport::transports+112>
#4 0x00005c008863bf75 in std::_Hashtable<i2p::data::Tag<32ul>, std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer>, std::allocator<std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer> >, std::__detail::_Select1st, std::equal_to<i2p::data::Tag<32ul> >, std::hash<i2p::data::Tag<32ul> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::find (
this=0x5c0088ba5890 <i2p::transport::transports+112>, __k=...) at /usr/include/c++/13.2.1/bits/hashtable.h:1664
__code = 131203317868794180
__bkt = 1404
#5 0x00005c0088639255 in std::unordered_map<i2p::data::Tag<32ul>, i2p::transport::Peer, std::hash<i2p::data::Tag<32ul> >, std::equal_to<i2p::data::Tag<32ul> >, std::allocator<std::pair<i2p::data::Tag<32ul> const, i2p::transport::Peer> > >::find (this=0x5c0088ba5890 <i2p::transport::transports+112>, __x=...) at /usr/include/c++/13.2.1/bits/unordered_map.h:876
No locals.
#6 0x00005c008862deec in i2p::transport::Transports::PostMessages (this=0x5c0088ba5820 <i2p::transport::transports>, ident=..., msgs=std::vector of length 1, capacity 1 = {...}) at /root/git/i2pd/libi2pd/Transports.cpp:460
it = {<std::__detail::_Node_iterator_base<std::pair<i2p::data::Tag<32> const, i2p::transport::Peer>, true>> = {_M_cur = 0x74e6043d5c80}, <No data fields>}
#7 0x00005c00886471c2 in std::__invoke_impl<void, void (i2p::transport::Transports::*&)(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >), i2p::transport::Transports*&, i2p::data::Tag<32ul>&, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >&> (
__f=@0x74e62fdffaa0: (void (i2p::transport::Transports::*)(i2p::transport::Transports * const, i2p::data::Tag<32>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)) 0x5c008862dd7e <i2p::transport::Transports::PostMessages(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>, __t=@0x74e62fdffae8: 0x5c0088ba5820 <i2p::transport::transports>)
at /usr/include/c++/13.2.1/bits/invoke.h:74
No locals.
#8 0x00005c0088646ccf in std::__invoke<void (i2p::transport::Transports::*&)(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >), i2p::transport::Transports*&, i2p::data::Tag<32ul>&, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >&> (
__fn=@0x74e62fdffaa0: (void (i2p::transport::Transports::*)(i2p::transport::Transports * const, i2p::data::Tag<32>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)) 0x5c008862dd7e <i2p::transport::Transports::PostMessages(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>) at /usr/include/c++/13.2.1/bits/invoke.h:96
No locals.
#9 0x00005c0088646843 in std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>::__call<void, , 0ul, 1ul, 2ul>(std::tuple<>&&, std::_Index_tuple<0ul, 1ul, 2ul>) (this=0x74e62fdffaa0, __args=...)
at /usr/include/c++/13.2.1/functional:506
No locals.
#10 0x00005c0088646473 in std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>::operator()<, void>() (this=0x74e62fdffaa0) at /usr/include/c++/13.2.1/functional:591
No locals.
#11 0x00005c0088645dbe in boost::asio::asio_handler_invoke<std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)> >(std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>&, ...) (function=...) at /usr/include/boost/asio/handler_invoke_hook.hpp:88
No locals.
#12 0x00005c008864544f in boost_asio_handler_invoke_helpers::invoke<std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>, std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)> >(std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>&, std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>&) (function=..., context=...)
at /usr/include/boost/asio/detail/handler_invoke_helpers.hpp:54
No locals.
#13 0x00005c0088644542 in boost::asio::detail::handler_work<std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>, boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul>, void>::complete<std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)> >(std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>&, std::_Bind<void (i2p::transport::Transports::*(i2p::transpo--Type <RET> for more, q to quit, c to continue without paging--c
rt::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>&) (this=0x74e62fdffa76, function=..., handler=...) at /usr/include/boost/asio/detail/handler_work.hpp:524
No locals.
#14 0x00005c0088642c50 in boost::asio::detail::completion_handler<std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*, i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >))(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>, boost::asio::io_context::basic_executor_type<std::allocator<void>, 0ul> >::do_complete(void*, boost::asio::detail::scheduler_operation*, boost::system::error_code const&, unsigned long) (owner=0x5c0089fe0fe0, base=0x74e604373350) at /usr/include/boost/asio/detail/completion_handler.hpp:74
b = {<boost::asio::detail::noncopyable> = {<No data fields>}, <No data fields>}
h = 0x74e604373350
p = {h = 0x74e62fdffaa0, v = 0x0, p = 0x0}
w = {<boost::asio::detail::handler_work_base<boost::asio::io_context::basic_executor_type<std::allocator<void>, 0>, void, boost::asio::io_context, boost::asio::executor, void>> = {<No data fields>}, <No data fields>}
handler = {<std::_Weak_result_type<void (i2p::transport::Transports::*)(i2p::data::Tag<32>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>> = {<std::_Weak_result_type_memfun<void (i2p::transport::Transports::*)(i2p::data::Tag<32>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >), true>> = {<No data fields>}, <No data fields>},
_M_f = (void (i2p::transport::Transports::*)(i2p::transport::Transports * const, i2p::data::Tag<32>,
std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)) 0x5c008862dd7e <i2p::transport::Transports::PostMessages(i2p::data::Tag<32ul>, std::vector<std::shared_ptr<i2p::I2NPMessage>, std::allocator<std::shared_ptr<i2p::I2NPMessage> > >)>, _M_bound_args = std::tuple containing = {[0] = 0x5c0088ba5820 <i2p::transport::transports>, [1] = {{
m_Buf = "DELETED", ll = {DELETED}}},
[2] = std::vector of length 1, capacity 1 = {std::shared_ptr<i2p::I2NPMessage> (use count 2, weak count 0) = {get() = 0x74e605720350}}}}
#15 0x00005c00884425ee in boost::asio::detail::scheduler_operation::complete (this=0x74e604373350, owner=0x5c0089fe0fe0, ec=..., bytes_transferred=0) at /usr/include/boost/asio/detail/scheduler_operation.hpp:40
No locals.
#16 0x00005c00884465c9 in boost::asio::detail::scheduler::do_run_one (this=0x5c0089fe0fe0, lock=..., this_thread=..., ec=...) at /usr/include/boost/asio/detail/impl/scheduler.ipp:493
task_result = 0
on_exit = {scheduler_ = 0x5c0089fe0fe0, lock_ = 0x74e62fdffbf0, this_thread_ = 0x74e62fdffc20}
o = 0x74e604373350
more_handlers = true
#17 0x00005c0088445f69 in boost::asio::detail::scheduler::run (this=0x5c0089fe0fe0, ec=...) at /usr/include/boost/asio/detail/impl/scheduler.ipp:210
this_thread = {<boost::asio::detail::thread_info_base> = {<boost::asio::detail::noncopyable> = {<No data fields>}, reusable_memory_ = {0x74e604373350, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, has_pending_exception_ = 0,
pending_exception_ = {_M_exception_object = 0x0}}, private_op_queue = {<boost::asio::detail::noncopyable> = {<No data fields>}, front_ = 0x0, back_ = 0x0}, private_outstanding_work = 0}
ctx = {<boost::asio::detail::noncopyable> = {<No data fields>}, key_ = 0x5c0089fe0fe0, value_ = 0x74e62fdffc20, next_ = 0x0}
lock = {<boost::asio::detail::noncopyable> = {<No data fields>}, mutex_ = @0x5c0089fe1010, locked_ = false}
n = 5780719
#18 0x00005c0088446a51 in boost::asio::io_context::run (this=0x5c008ad4ee30) at /usr/include/boost/asio/impl/io_context.ipp:64
ec = {{d1_ = {val_ = 0, cat_ = 0x0}, d2_ = '\000' <repeats 15 times>}, lc_flags_ = 0}
s = 16624203274566672384
#19 0x00005c008862d4c8 in i2p::transport::Transports::Run (this=0x5c0088ba5820 <i2p::transport::transports>) at /root/git/i2pd/libi2pd/Transports.cpp:366
No locals.
#20 0x00005c0088648271 in std::__invoke_impl<void, void (i2p::transport::Transports::*&)(), i2p::transport::Transports*&> (
__f=@0x5c008ad4f178: (void (i2p::transport::Transports::*)(i2p::transport::Transports * const)) 0x5c008862d48c <i2p::transport::Transports::Run()>, __t=@0x5c008ad4f188: 0x5c0088ba5820 <i2p::transport::transports>)
at /usr/include/c++/13.2.1/bits/invoke.h:74
No locals.
#21 0x00005c008864813d in std::__invoke<void (i2p::transport::Transports::*&)(), i2p::transport::Transports*&> (
__fn=@0x5c008ad4f178: (void (i2p::transport::Transports::*)(i2p::transport::Transports * const)) 0x5c008862d48c <i2p::transport::Transports::Run()>) at /usr/include/c++/13.2.1/bits/invoke.h:96
No locals.
#22 0x00005c008864805b in std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*))()>::__call<void, , 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) (this=0x5c008ad4f178, __args=...)
at /usr/include/c++/13.2.1/functional:506
No locals.
#23 0x00005c0088647f63 in std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*))()>::operator()<, void>() (this=0x5c008ad4f178) at /usr/include/c++/13.2.1/functional:591
No locals.
#24 0x00005c0088647eae in std::__invoke_impl<void, std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*))()>>(std::__invoke_other, std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*))()>&&)
(__f=...) at /usr/include/c++/13.2.1/bits/invoke.h:61
No locals.
#25 0x00005c0088647e34 in std::__invoke<std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*))()>>(std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*))()>&&) (__fn=...)
at /usr/include/c++/13.2.1/bits/invoke.h:96
No locals.
#26 0x00005c0088647d8e in std::thread::_Invoker<std::tuple<std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*))()> > >::_M_invoke<0ul>(std::_Index_tuple<0ul>) (this=0x5c008ad4f178)
at /usr/include/c++/13.2.1/bits/std_thread.h:292
No locals.
#27 0x00005c0088647cfa in std::thread::_Invoker<std::tuple<std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*))()> > >::operator()() (this=0x5c008ad4f178) at /usr/include/c++/13.2.1/bits/std_thread.h:299
No locals.
#28 0x00005c0088647c8e in std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Bind<void (i2p::transport::Transports::*(i2p::transport::Transports*))()> > > >::_M_run() (this=0x5c008ad4f170)
at /usr/include/c++/13.2.1/bits/std_thread.h:244
No locals.
#29 0x000074e636ce1943 in std::execute_native_thread_routine (__p=0x5c008ad4f170) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
__t = <optimized out>
#30 0x000074e636aa955a in start_thread (arg=<optimized out>) at pthread_create.c:447
ret = <optimized out>
pd = <optimized out>
out = <optimized out>
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {DELETED}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0},
data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call = <optimized out>
#31 0x000074e636b26a5c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
No locals.
m_Peers.find in Transports.cpp often lack mutex locks.
However it's not easy to rewrite this code properly.
https://github.com/PurpleI2P/i2pd/blob/6ce2c30522a01534521354e83ee94f24d17bbf6e/libi2pd/Transports.cpp#L460
The router worked without errors all the time, but since yesterday it has crashed three times, is this somehow related to the attacks (like dos? or remote crash?) or is it simply because of the load that the chance of a crash in thread is greater?
Attack produces load and load produces crashes. I don't think attack targets this particular place in code.
@Vort you mentioned in #2057 that "(fast, happens during shutdown)", initially I find out that there is a problem with the router when my uptimerobot signals that port i2pd is not listening, while i2pd itself works (as far as I understand), and only when shutting down gives SEGV. So I think the problem starts not when you turn it off, but before.
I saw many times that OOM and crashes happen when I shut down completely correctly working i2pd instance.
By the way, I figured out that m_Peers.insert (std::pair line is responsible both for OOM and some of the crashes. Result is random.
I think you found some other problem, then initiated shutdown and triggered crash just because of shutdown.