nasa / HDTN

High-rate Delay Tolerant Network (HDTN) Software
https://www1.grc.nasa.gov/space/scan/acs/tech-studies/dtn/
Other
95 stars 24 forks source link

bpsink core dumps when fails to bind #46

Open dklimkin opened 1 year ago

dklimkin commented 1 year ago

In case the bind port is already used, boost::system::system_error is thrown which leads to terminate and a coredump:

[ bpsink   ][ info ]: This is HDTN version 1.0.0
[ bpsink   ][ info ]: starting..
[ bpsink   ][ info ]: All LTP UDP engines can receive a maximum of 65535 bytes per packet
terminate called after throwing an instance of 'boost::wrapexcept<boost::system::system_error>'
what():  bind: Address already in use
Aborted (core dumped)
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007f562805a859 in __GI_abort () at abort.c:79
#2  0x00007f56282e5911 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007f56282f138c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007f56282f13f7 in std::terminate() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007f56282f16a9 in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00005642b00fec2b in void boost::throw_exception<boost::system::system_error>(boost::system::system_error const&) ()
#7  0x00005642b00f8451 in boost::asio::detail::do_throw_error(boost::system::error_code const&, char const*) ()
#8  0x00005642b00f8332 in boost::asio::detail::throw_error(boost::system::error_code const&, char const*) ()
#9  0x00005642b017404a in boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::executor>::basic_socket_acceptor<boost::asio::io_context>(boost::asio::io_context&, boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&, bool, std::enable_if<std::is_convertible<boost::asio::io_context&, boost::asio::execution_context&>::value, void>::type*) ()
#10 0x00005642b0180b75 in TcpclV4Induct::TcpclV4Induct(boost::function<void (std::vector<unsigned char, PaddedMallocator<unsigned char> >&)> const&, induct_element_config_t const&, unsigned long, unsigned long, boost::function<void (unsigned long, Induct*, void*)> const&, boost::function<void (unsigned long, Induct*, void*)> const&) ()
#11 0x00005642b0194cd8 in boost::enable_if_<!boost::is_array<TcpclV4Induct>::value, std::unique_ptr<TcpclV4Induct, std::default_delete<TcpclV4Induct> > >::type boost::make_unique<TcpclV4Induct, boost::function<void (std::vector<unsigned char, PaddedMallocator<unsigned char> >&)> const&, induct_element_config_t const&, unsigned long const&, unsigned long const&, boost::function<void (unsigned long, Induct*, void*)> const&, boost::function<void (unsigned long, Induct*, void*)> const&>(boost::function<void (std::vector<unsigned char, PaddedMallocator<unsigned char> >&)>const&, induct_element_config_t const&, unsigned long const&, unsigned long const&, boost::function<void (unsigned long, Induct*, void*)> const&, boost::function<void (unsigned long, Induct*, void*)> const&) ()
#12 0x00005642b0193d21 in InductManager::LoadInductsFromConfig(boost::function<void (std::vector<unsigned char, PaddedMallocator<unsigned char> >&)> const&, InductsConfig const&, unsigned long, unsigned long, unsigned long, boost::function<void (unsigned long, Induct*, void*)> const&, boost::function<void (unsigned long, Induct*, void*)> const&) ()
#13 0x00005642b011e555 in BpSinkPattern::Init(std::shared_ptr<InductsConfig>&, std::shared_ptr<OutductsConfig>&, bool, cbhe_eid_t const&, unsigned int, unsigned long, unsigned long) ()
#14 0x00005642b00dd20f in BpSinkAsyncRunner::Run(int, char const* const*, bool volatile&, bool) ()
#15 0x00005642b00d87fb in main ()

This should probably be handled nicer.