Injector crashes when listening on TCP
When running the command ./injector --repo ../repos/injector --listen-on-tcp 127.0.0.1:8080 --listen-on-i2p false
from the build
directory under a checkout of commit ef66c0dd from master
, with an empty repo, I get this crash:
Default RLIMIT_NOFILE value is: 1024
RLIMIT_NOFILE value changed to: 32768
generating 2048-bit RSA keypair...done
peer identity: […]
Swarm listening on […]
Warning: Couldn't open ../repos/injector/ipfs/ipfs_cache_db.[…].json
IPNS DB: […]
=================================================================
==3619==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffc5ab9a7e0 at pc 0x55968d19840e bp 0x6310000382d0 sp 0x6310000382c8
READ of size 28 at 0x7ffc5ab9a7e0 thread T0
#0 0x55968d19840d in boost::asio::ip::detail::endpoint::endpoint(boost::asio::ip::detail::endpoint const&) /usr/include/boost/asio/ip/detail/endpoint.hpp:48
#1 0x55968d1b8928 in boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>::basic_endpoint(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&) /usr/include/boost/asio/ip/basic_endpoint.hpp:97
#2 0x55968d162af2 in operator() /home/ivan/vc/git/ouinet/src/injector.cpp:438
#3 0x55968d179102 in operator() /usr/include/boost/asio/impl/spawn.hpp:273
#4 0x55968d177bbd in run /usr/include/boost/coroutine/detail/push_coroutine_object.hpp:293
#5 0x55968d17724d in trampoline_push_void<boost::coroutines::detail::push_coroutine_object<boost::coroutines::pull_coroutine<void>, void, boost::asio::detail::coro_entry_point<boost::asio::detail::wrapped_handler<boost::asio::io_service::strand, void (*)(), boost::asio::detail::is_continuation_if_running>, main(int, char**)::<lambda(boost::asio::yield_context)> >&, boost::coroutines::basic_standard_stack_allocator<boost::coroutines::stack_traits> > > /usr/include/boost/coroutine/detail/trampoline_push.hpp:70
#6 0x7f8419cf8f7a in make_fcontext (/lib/x86_64-linux-gnu/libboost_context.so.1.62.0+0xf7a)
Address 0x7ffc5ab9a7e0 is located in stack of thread T0 at offset 1440 in frame
#0 0x55968d163223 in main /home/ivan/vc/git/ouinet/src/injector.cpp:340
This frame has 50 object(s):
[…]
[1440, 1468) 'injector_ep' <== Memory access at offset 1440 is inside this variable
[…]
SUMMARY: AddressSanitizer: stack-use-after-scope /usr/include/boost/asio/ip/detail/endpoint.hpp:48 in boost::asio::ip::detail::endpoint::endpoint(boost::asio::ip::detail::endpoint const&)
[…]
==3619==ABORTING
The program dies with exit code 1. Running the command again (supposedly now with an existing IPFS repo) crashes in the same way.
I traced the error back to commit 7c3ca08b (same command without --listen-on-i2p
option), i.e. the crash is present in that and later commits but not in the previous commit 565c33b2 and older.