I have a problem in C++ TCP Server(using boost asio).
In normal client, Many clients connect to server is normal.
But if every client connect and disconnect server 10 times/sec, Server core some time.
(1)create server like this:
void ClientConnection::start()
{
socket_.async_read_some(boost::asio::buffer(buffer_),
strand_.wrap(
boost::bind(&connection::handle_read, shared_from_this(),
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred)));
}
void ClientConnection::closeSocket() {
mStrand.post(boost::bind(&ClientConnection::innerCloseSocket, this->shared_from_this()));
}
void ClientConnection::innerCloseSocket() {
boost::system::error_code error;
mSocket.close(error);
LOG_INFO("Close client[" << mClientId << "] socket connection"); //line:216
}
ClientConnection::~ClientConnection() {
}
(2) hand_read like this:
void ClientConnection::handle_read(const boost::system::error_code& e,
std::size_t bytes_transferred)
{
if (!e)
{
//read data and use it
}
else { //error occurs
closeSocket();
boost::shared_ptr<DisConnectCommand> cmd(new DisConnectCommand());
cmd->setClient(this->weak_from_this()); //here set this connection weak_ptr
putCmd(cmd); //do something in other thread.
}
}
(3) handle_write like this:
void ClientConnection::handle_write(const boost::system::error_code& e)
{
if (!e)
{
//send data
}
else { //error occurs
closeSocket();
boost::shared_ptr<DisConnectCommand> cmd(new DisConnectCommand());
cmd->setClient(this->weak_from_this()); //here set this connection weak_ptr
putCmd(cmd); //do something in other thread.
}
}
core
but, when lots of client connect to server, server core. The core likes a connection has been destructed tow times, the memory is error.
bt like this:
#0 0x00007f6e3aa561f7 in raise () from /lib64/libc.so.6
#1 0x00007f6e3aa578e8 in abort () from /lib64/libc.so.6
#2 0x00007f6e3b35c9d5 in __gnu_cxx::__verbose_terminate_handler() () from /lib64/libstdc++.so.6
#3 0x00007f6e3b35a946 in ?? () from /lib64/libstdc++.so.6
#4 0x00007f6e3b35a973 in std::terminate() () from /lib64/libstdc++.so.6
#5 0x00007f6e3b35ab93 in __cxa_throw () from /lib64/libstdc++.so.6
#6 0x00007f6e3b35b12d in operator new(unsigned long) () from /lib64/libstdc++.so.6
#7 0x00007f6e3b3b9c79 in std::string::_Rep::_S_create(unsigned long, unsigned long, std::allocator<char> const&) () from /lib64/libstdc++.so.6
#8 0x00007f6e3b3ba8bb in std::string::_Rep::_M_clone(std::allocator<char> const&, unsigned long) () from /lib64/libstdc++.so.6
#9 0x00007f6e3b3ba964 in std::string::reserve(unsigned long) () from /lib64/libstdc++.so.6
#10 0x00007f6e3b3baa28 in std::string::append(std::string const&) () from /lib64/libstdc++.so.6
#11 0x00007f6e3be5c4c8 in log4cxx::helpers::CharMessageBuffer::operator<< (this=0x7f6e20ff8750, msg=...) at messagebuffer.cpp:31
#12 0x00000000008a3a05 in ClientConnection::internalCloseSocket (this=0x7f6e046fefd0) at src/business/ClientConnection.cpp:216
#13 0x00000000008b620a in boost::_mfi::mf0<void, ClientConnection>::call<boost::shared_ptr<ClientConnection> > (this=0x7f6e20ff89c0, u=...)
at externals/boost/include/boost/bind/mem_fn_template.hpp:40
#14 0x00000000008b5c79 in boost::_mfi::mf0<void, ClientConnection>::operator()<boost::shared_ptr<ClientConnection> > (this=0x7f6e20ff89c0, u=...)
at externals/boost/include/boost/bind/mem_fn_template.hpp:55
#15 0x00000000008b5416 in boost::_bi::list1<boost::_bi::value<boost::shared_ptr<ClientConnection> > >::operator()<boost::_mfi::mf0<void, ClientConnection>, boost::_bi::list0> (
this=0x7f6e20ff89d0, f=..., a=...) at externals/boost/include/boost/bind/bind.hpp:259
#16 0x00000000008b4997 in boost::_bi::bind_t<void, boost::_mfi::mf0<void, ClientConnection>, boost::_bi::list1<boost::_bi::value<boost::shared_ptr<ClientConnection> > > >::operator() (this=0x7f6e20ff89c0) at externals/boost/include/boost/bind/bind.hpp:1294
#17 0x00000000008b3667 in boost::asio::asio_handler_invoke<boost::_bi::bind_t<void, boost::_mfi::mf0<void, ClientConnection>, boost::_bi::list1<boost::_bi::value<boost::shared_ptr<ClientConnection> > > > > (function=...) at externals/boost/include/boost/asio/handler_invoke_hook.hpp:69
#18 0x00000000008b235a in boost_asio_handler_invoke_helpers::invoke<boost::_bi::bind_t<void, boost::_mfi::mf0<void, ClientConnection>, boost::_bi::list1<boost::_bi::value<boost::shared_ptr<ClientConnection> > > >, boost::_bi::bind_t<void, boost::_mfi::mf0<void, ClientConnection>, boost::_bi::list1<boost::_bi::value<boost::shared_ptr<ClientConnection> > > > > (
function=..., context=...) at externals/boost/include/boost/asio/detail/handler_invoke_helpers.hpp:37
#19 0x00000000008b0ee3 in boost::asio::detail::completion_handler<boost::_bi::bind_t<void, boost::_mfi::mf0<void, ClientConnection>, boost::_bi::list1<boost::_bi::value<boost::shared_ptr<ClientConnection> > > > >::do_complete (owner=0x1a5a5c0, base=0x7f6e28018f30) at externals/boost/include/boost/asio/detail/completion_handler.hpp:68
#20 0x00000000007c3ef4 in boost::asio::detail::task_io_service_operation::complete (this=0x7f6e28018f30, owner=..., ec=..., bytes_transferred=0)
at externals/boost/include/boost/asio/detail/task_io_service_operation.hpp:38
#21 0x00000000007c7937 in boost::asio::detail::strand_service::do_complete (owner=0x1a5a5c0, base=0x7f6df001ab40, ec=...) at externals/boost/include/boost/asio/detail/impl/strand_service.ipp:167
#22 0x00000000007c3ef4 in boost::asio::detail::task_io_service_operation::complete (this=0x7f6df001ab40, owner=..., ec=..., bytes_transferred=0)
at externals/boost/include/boost/asio/detail/task_io_service_operation.hpp:38
#23 0x00000000007c5dde in boost::asio::detail::task_io_service::do_run_one (this=0x1a5a5c0, lock=..., this_thread=..., ec=...) at externals/boost/include/boost/asio/detail/impl/task_io_service.ipp:372
#24 0x00000000007c5845 in boost::asio::detail::task_io_service::run (this=0x1a5a5c0, ec=...) at externals/boost/include/boost/asio/detail/impl/task_io_service.ipp:149
#25 0x00000000007c60cf in boost::asio::io_service::run (this=0x1a54b10) at externals/boost/include/boost/asio/impl/io_service.ipp:59
#26 0x00000000008c27b6 in ProcessModule::threadRun (this=0x1a54b10) at src/business/ProcessModule.cpp:149
#27 0x00000000008c82e7 in boost::_mfi::mf0<void, ProcessModule>::operator() (this=0x1b0aee8, p=0x1a54b10) at externals/boost/include/boost/bind/mem_fn_template.hpp:49
#28 0x00000000008c824a in boost::_bi::list1<boost::_bi::value<ProcessModule*> >::operator()<boost::_mfi::mf0<void, ProcessModule>, boost::_bi::list0> (this=0x1b0aef8,
f=..., a=...) at externals/boost/include/boost/bind/bind.hpp:259
#29 0x00000000008c81f9 in boost::_bi::bind_t<void, boost::_mfi::mf0<void, ProcessModule>, boost::_bi::list1<boost::_bi::value<ProcessModule*> > >::operator() (
this=0x1b0aee8) at externals/boost/include/boost/bind/bind.hpp:1294
#30 0x00000000008c811a in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, ProcessModule>, boost::_bi::list1<boost::_bi::value<ProcessModule*> > > >::run (this=0x1b0ad30) at externals/boost/include/boost/thread/detail/thread.hpp:116
(gdb) p *this
$1 = {<boost::enable_shared_from_this<ClientConnection>> = {weak_this_ = {px = 0x7f981c4cf720, pn = {pi_ = 0x7f981c2feca0}}}, <boost::noncopyable_::noncopyable> = {<No data fields>},
mIoService = #0x1333b10,
mSocket = {<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >> = {<boost::asio::basic_io_object<boost::asio::stream_socket_service<boost::asio::ip::tcp>, true>> = {implementation = {<boost::asio::detail::reactive_socket_service_base::base_implementation_type> = {socket_ = -1, state_ = 0 '\000', reactor_data_ = 0x0}, protocol_ = {family_ = 2}},
service_ = 0x1371560}, <boost::asio::socket_base> = {static message_peek = 2, static message_out_of_band = 1, static message_do_not_route = 4, static message_end_of_record = 128,
static max_connections = 128}, <No data fields>}, <No data fields>}, mStrand = {service_ = #0x13e5510, impl_ = 0x7f98080500a0},
ClientConnection.cpp:216 is
LOG_INFO("Close client[" << mClientId << "] socket connection");//line:216
the mClientId is wrong value. it looks like This class is destroyed.
weak ptr like:
(gdb) frame 12
(gdb) p *(weak_this_.pn.pi_)
$3 = {_vptr.sp_counted_base = 0x957710 <vtable for boost::detail::sp_counted_impl_p<ClientConnection>+16>, use_count_ = {_M_i = 3}, weak_count_ = {_M_i = 2}}
boost_asio/example
I have search it on internet, find https://www.boost.org/doc/libs/1_45_0/doc/html/boost_asio/example/http/server3/connection.cpp
the example have a note like:
int handle_read:
// If an error occurs then no new asynchronous operations are started. This
// means that all shared_ptr references to the connection object will
// disappear and the object will be destroyed automatically after this
// handler returns. The connection class's destructor closes the socket.
int handle_write:
// No new asynchronous operations are started. This means that all shared_ptr
// references to the connection object will disappear and the object will be
// destroyed automatically after this handler returns. The connection class's
// destructor closes the socket.
why?
(i) If an error occurs in handle_read/handle_write, shouldn't I use this connection weak_ptr in other threads?
(ii) The ClientConnection class life cycle is In Asio and is controled by Asio, What's wrong in my code?
(iii) I think it can't use stand.post() and connection's weak_ptr to do something. Should modify code like below?
void ClientConnection::handle_read(const boost::system::error_code& e,
std::size_t bytes_transferred)
{
if (!e)
{
//read data and use it
}
else { //error occurs
//closeSocket();
//boost::shared_ptr<DisConnectCommand> cmd(new DisConnectCommand());
//cmd->setClient(this->weak_from_this()); //here set this connection weak_ptr
//putCmd(cmd); //do something in other thread.
//just close socket
boost::system::error_code error;
mSocket.close(error);
}
}
I am online and looking forward for your help.
thank you. best wish.
Related
My server has been running for more than 20 hours for a long time. During this period, I stress test the server uninterruptedly. Sometimes it crashes, sometimes it does not crash. I am using Asio only Asio Only Source Code to handle my network class.
void AsioChannel::AsyncSendData(const std::shared_ptr<Buffer>& packet)
{
sendding_.store(true);
auto self = shared_from_this();
socket_.async_write_some(asio::buffer(packet->peek(), packet->readableBytes()),
[self, packet](const std::error_code& err, std::size_t writen)
{
self->AsyncWriteSomeCallback(err,packet,writen);
});
}
void AsioChannel::AsyncWriteSomeCallback(const std::error_code& error, const std::shared_ptr<Buffer>& packet, std::size_t writen)
{
if (error)
{
return;
}
if (writen < packet->readableBytes())
{
packet->retrieve(writen);
AsyncSendData(packet);
}
else
{
if(!waitwriteq_.empty())
{
auto next = waitwriteq_.front();
waitwriteq_.pop();
AsyncSendData(next);
}
else
{
sendding_.store(false);
}
}
}
The crash stack is as follows
#0 0x00007f172a8255f7 in raise () from /lib64/libc.so.6
#1 0x00007f172a826e28 in abort () from /lib64/libc.so.6
#2 0x00007f172a865317 in __libc_message () from /lib64/libc.so.6
#3 0x00007f172a86cfe1 in _int_free () from /lib64/libc.so.6
#4 0x00007f172b92b49d in allocate<asio::detail::thread_info_base::default_tag> (size=168, this_thread=<optimized out>) at /opt/env/include/c++/10.2.0/ext/atomicity.h:97
#5 allocate (size=168, this_thread=<optimized out>) at asio/detail/thread_info_base.hpp:73
#6 asio_handler_allocate (size=168) at asio/impl/handler_alloc_hook.ipp:34
#7 allocate<net::AsioChannel::AsyncSendData(const std::shared_ptr<Buffer>&)::<lambda(const std::error_code&, std::size_t)> > (h=..., s=168)
at asio/detail/handler_alloc_helpers.hpp:70
#8 allocate (n=1, this=<synthetic pointer>) at asio/detail/handler_alloc_helpers.hpp:127
#9 allocate (handler=...) at asio/detail/reactive_socket_send_op.hpp:103
#10 async_send<asio::const_buffers_1, net::AsioChannel::AsyncSendData(const std::shared_ptr<Buffer>&)::<lambda(const std::error_code&, std::size_t)>, asio::execution::any_executor<asio::execution::context_as_t<asio::execution_context&>, asio::execution::detail::blocking::never_t<0>, asio::execution::prefer_only<asio::execution::detail::blocking::possibly_t<0> >, asio::execution::prefer_only<asio::execution::detail::outstanding_work::tracked_t<0> >, asio::execution::prefer_only<asio::execution::detail::outstanding_work::untracked_t<0> >, asio::execution::prefer_only<asio::execution::detail::relationship::fork_t<0> >, asio::execution::prefer_only<asio::execution::detail::relationship::continuation_t<0> > > > (io_ex=..., handler=..., flags=0,
buffers=..., impl=..., this=0x7f17080009f8) at asio/detail/reactive_socket_service_base.hpp:281
#11 operator()<net::AsioChannel::AsyncSendData(const std::shared_ptr<Buffer>&)::<lambda(const std::error_code&, std::size_t)>, asio::const_buffers_1> (flags=0, buffers=...,
handler=<unknown type in /libgamesh.net.so, CU 0x0, DIE 0x6e7c8>, this=<optimized out>)
at asio/basic_stream_socket.hpp:1005
#12 initiate<asio::basic_stream_socket<asio::ip::tcp>::initiate_async_send, net::AsioChannel::AsyncSendData(const std::shared_ptr<Buffer>&)::<lambda(const std::error_code&, std::size_t)>, const asio::const_buffers_1&, int> (token=<unknown type in /libgamesh.net.so, CU 0x0, DIE 0x6e78e>,
initiation=<optimized out>) at asio/async_result.hpp:151
#13 async_initiate<net::AsioChannel::AsyncSendData(const std::shared_ptr<Buffer>&)::<lambda(const std::error_code&, std::size_t)>, void(std::error_code, long unsigned int), asio::basic_stream_socket<asio::ip::tcp>::initiate_async_send, const asio::const_buffers_1&, int> (token=..., initiation=<optimized out>)
at asio/async_result.hpp:364
#14 async_write_some<asio::const_buffers_1, net::AsioChannel::AsyncSendData(const std::shared_ptr<Buffer>&)::<lambda(const std::error_code&, std::size_t)> > (
handler=<unknown type in /libgamesh.net.so, CU 0x0, DIE 0x6e6e1>, buffers=..., this=0x7f1708143480)
at asio/basic_stream_socket.hpp:855
#15 net::AsioChannel::AsyncSendData (this=0x7f1708143460, packet=...) at net/asio_channel.cpp:326
#16 0x00007f172b92b964 in net::AsioChannel::SendPacket (this=<optimized out>, packet=..., size=<optimized out>)
at net/asio_channel.cpp:284
#17 0x00007f172b93cb1e in net::AsioServerHandler::SendPacket (this=<optimized out>, pPacket=..., size=<optimized out>) at /opt/env/include/c++/10.2.0/bits/shared_ptr_base.h:1324
#18 0x00007f172b946831 in operator() (__closure=<optimized out>) at /opt/env/include/c++/10.2.0/bits/shared_ptr_base.h:1324
#19 __invoke_impl<void, net::Asio_SendPacket(uint32_t, char const*, uint32_t)::<lambda()>&> (__f=...) at /opt/env/include/c++/10.2.0/bits/invoke.h:60
#20 __invoke_r<void, net::Asio_SendPacket(uint32_t, char const*, uint32_t)::<lambda()>&> (__fn=...) at /opt/env/include/c++/10.2.0/bits/invoke.h:110
#21 std::_Function_handler<void(), net::Asio_SendPacket(uint32_t, char const*, uint32_t)::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...)
at /opt/env/include/c++/10.2.0/bits/std_function.h:291
#22 0x00007f172c42ee26 in std::function<void ()>::operator()() const (this=<optimized out>) at /opt/env/include/c++/10.2.0/bits/std_function.h:248
#23 0x00007f172b93b0b4 in asio_handler_invoke<std::function<void()> > (function=...)
at asio/handler_invoke_hook.hpp:85
#24 invoke<std::function<void()>, std::function<void()> > (context=..., function=...)
at asio/detail/handler_invoke_helpers.hpp:54
#25 complete<std::function<void()> > (handler=..., function=..., this=<synthetic pointer>)
at asio/detail/handler_work.hpp:424
#26 asio::detail::completion_handler<std::function<void ()>, asio::io_context::basic_executor_type<std::allocator<void>, 0u> >::do_complete(void*, asio::detail::scheduler_operation*, std::error_code const&, unsigned long) (owner=0x5011470, base=0x7f15c7b2f4a0) at asio/detail/completion_handler.hpp:73
#27 0x00007f172b932d88 in complete (bytes_transferred=0, ec=..., owner=0x5011470, this=0x7f15c7b2f4a0)
at asio/detail/scheduler_operation.hpp:39
#28 asio::detail::scheduler::do_run_one (this=this#entry=0x5011470, lock=..., this_thread=..., ec=...)
at asio/detail/impl/scheduler.ipp:480
#29 0x00007f172b934336 in asio::detail::scheduler::run (this=0x5011470, ec=...)
at asio/detail/impl/scheduler.ipp:203
---Type <return> to continue, or q <return> to quit---
#30 0x00007f172b9394c6 in run (this=0x50113c8) at asio/impl/io_context.ipp:62
#31 net::AsioEventLoop::Run (this=0x50113c0) at net/asio_event_loop.cpp:30
#32 0x00007f172b942ae1 in net::EventLoopThread::Run(std::function<int ()> const&, std::function<int ()> const&) (this=0x4fe9ec0, pre=..., post=...)
at /opt/env/include/c++/10.2.0/bits/unique_ptr.h:421
#33 0x00007f172b942e6f in __invoke_impl<void, void (net::EventLoopThread::*&)(const std::function<int()>&, const std::function<int()>&), net::EventLoopThread*&, std::function<int()>&, std::function<int()>&> (__t=<optimized out>, __f=<optimized out>) at /opt/env/include/c++/10.2.0/bits/invoke.h:89
#34 __invoke<void (net::EventLoopThread::*&)(const std::function<int()>&, const std::function<int()>&), net::EventLoopThread*&, std::function<int()>&, std::function<int()>&> (
__fn=<optimized out>) at /opt/env/include/c++/10.2.0/bits/invoke.h:95
#35 __call<void, 0, 1, 2> (__args=<optimized out>, this=<optimized out>) at /opt/env/include/c++/10.2.0/functional:416
#36 operator()<> (this=<optimized out>) at /opt/env/include/c++/10.2.0/functional:499
#37 __invoke_impl<void, std::_Bind<void (net::EventLoopThread::*(net::EventLoopThread*, std::function<int()>, std::function<int()>))(const std::function<int()>&, const std::function<int()>&)> > (__f=<optimized out>) at /opt/env/include/c++/10.2.0/bits/invoke.h:60
#38 __invoke<std::_Bind<void (net::EventLoopThread::*(net::EventLoopThread*, std::function<int()>, std::function<int()>))(const std::function<int()>&, const std::function<int()>&)> > (__fn=<optimized out>) at /opt/env/include/c++/10.2.0/bits/invoke.h:95
#39 _M_invoke<0> (this=<optimized out>) at /opt/env/include/c++/10.2.0/thread:264
#40 operator() (this=<optimized out>) at /opt/env/include/c++/10.2.0/thread:271
#41 std::thread::_State_impl<std::thread::_Invoker<std::tuple<std::_Bind<void (net::EventLoopThread::*(net::EventLoopThread*, std::function<int ()>, std::function<int ()>))(std::function<int ()> const&, std::function<int ()> const&)> > > >::_M_run() (this=<optimized out>) at /opt/env/include/c++/10.2.0/thread:215
#42 0x00007f172aca2f70 in execute_native_thread_routine () at ../../../../../libstdc++-v3/src/c++11/thread.cc:80
#43 0x00007f172c1c8dc5 in start_thread () from /lib64/libpthread.so.0
#44 0x00007f172a8e61cd in clone () from /lib64/libc.so.6
(gdb)
Why is the response causing a crash?
Not using Boost
Compiled with g++ 10.2.0 in C++17 mode
Running libstdc++ of GCC10 for C++17 feature support
Running on Red Hat Enterprise Linux Server release 7.2 (Maipo)
Everything compiled with -O2
Code:
Listener.hpp:
template <typename SocketType>
void Listener<SocketType>::BeginAccept()
{
auto worker = SelectWorker();
auto socket = worker->CreateSocket();
m_acceptor->async_accept(socket->GetAsioSocket(),
[this, worker, socket] (const boost::system::error_code &ec)
{
this->OnAccept(worker, socket, ec);
});
}
template <typename SocketType>
void Listener<SocketType>::OnAccept(NetworkThread<SocketType> *worker, std::shared_ptr<SocketType> const& socket, const boost::system::error_code &ec)
{
// an error has occurred
if (ec)
worker->RemoveSocket(socket.get());
else
socket->Open();
BeginAccept();
}
Socket.cpp:
bool Socket::Open()
{
try
{
const_cast<std::string &>(m_address) = m_socket.remote_endpoint().address().to_string();
const_cast<std::string &>(m_remoteEndpoint) = boost::lexical_cast<std::string>(m_socket.remote_endpoint());
}
catch (boost::system::error_code& error)
{
sLog.outInfo("Socket::Open() failed to get remote address. Error: %s", error.message().c_str());
return false;
}
catch (const std::exception& error)
{
sLog.outInfo("Socket::Open() failed(with std::exception) to get remote address. Error: %s", error.what());
return false;
}
catch (...)
{
sLog.outError("Socket::Open() failed to get remote address. Other error");
return false;
}
m_outBuffer.reset(new PacketBuffer);
m_secondaryOutBuffer.reset(new PacketBuffer);
m_inBuffer.reset(new PacketBuffer);
StartAsyncRead();
return true;
}
Is this related to TCP attack?
EDIT: gdb:
(gdb) p m_socket
$1 = {<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >> = {<boost::asio::basic_io_object<boost::asio::stream_socket_service<boost::asio::ip::tcp>, true>> = {
implementation = {<boost::asio::detail::reactive_socket_service_base::base_implementation_type> = {socket_ = 21, state_ = 80 'P', reactor_data_ = 0x7ffff0005120}, protocol_ = {family_ = 2}}, service_ = 0x7f2b30}, <boost::asio::socket_base> = {
static message_peek = 2, static message_out_of_band = 1, static message_do_not_route = 4, static message_end_of_record = 128, static max_connections = 128}, <No data fields>}, <No data fields>}
(gdb) p m_socket.is_open()
$2 = true
(gdb) bt
#0 MaNGOS::Socket::Open (this=0x7ffff0003c40) at /home/ubuntu/MoltenCore/MoltenCore/src/shared/Network/Socket.cpp:52
#1 0x00000000004fbff1 in MaNGOS::Listener<AuthSocket>::OnAccept (this=0x7fffffffe6c0, worker=0x8041e0, socket=std::shared_ptr (count 2, weak 1) 0x7ffff0003c40, ec=...) at /home/ubuntu/MoltenCore/MoltenCore/src/shared/Network/Listener.hpp:121
#2 0x00000000004fa030 in MaNGOS::Listener<AuthSocket>::BeginAccept()::{lambda(boost::system::error_code const&)#1}::operator()(boost::system::error_code const&) const (__closure=0x7ffff4ec8be0, ec=...)
at /home/ubuntu/MoltenCore/MoltenCore/src/shared/Network/Listener.hpp:110
#3 0x0000000000502a2d in boost::asio::detail::binder1<MaNGOS::Listener<AuthSocket>::BeginAccept()::{lambda(boost::system::error_code const&)#1}, boost::system::error_code>::operator()() (this=0x7ffff4ec8be0) at /usr/include/boost/asio/detail/bind_handler.hpp:47
#4 0x00000000005020c3 in boost::asio::asio_handler_invoke<boost::asio::detail::binder1<MaNGOS::Listener<AuthSocket>::BeginAccept()::{lambda(boost::system::error_code const&)#1}, boost::system::error_code> >(boost::asio::detail::binder1<MaNGOS::Listener<AuthSocket>::BeginAccept()::{lambda(boost::system::error_code const&)#1}, boost::system::error_code>&, ...) (function=...) at /usr/include/boost/asio/handler_invoke_hook.hpp:69
#5 0x00000000005014b8 in boost_asio_handler_invoke_helpers::invoke<boost::asio::detail::binder1<MaNGOS::Listener<AuthSocket>::BeginAccept()::{lambda(boost::system::error_code const&)#1}, boost::system::error_code>, {lambda(boost::system::error_code const&)#1}>(boost::asio::detail::binder1<MaNGOS::Listener<AuthSocket>::BeginAccept()::{lambda(boost::system::error_code const&)#1}, boost::system::error_code>&, {lambda(boost::system::error_code const&)#1}&) (function=..., context=...)
at /usr/include/boost/asio/detail/handler_invoke_helpers.hpp:37
#6 0x0000000000500886 in boost::asio::detail::reactive_socket_accept_op<boost::asio::basic_socket<boost::asio::ip::tcp, boost::asio::stream_socket_service<boost::asio::ip::tcp> >, boost::asio::ip::tcp, MaNGOS::Listener<AuthSocket>::BeginAccept()::{lambda(boost::system::error_code const&)#1}>::do_complete(boost::asio::detail::task_io_service*, boost::asio::detail::task_io_service_operation*, boost::system::error_code const&, unsigned long) (owner=0x8084d0, base=0x804910) at /usr/include/boost/asio/detail/reactive_socket_accept_op.hpp:123
#7 0x00000000004f0300 in boost::asio::detail::task_io_service_operation::complete (this=0x804910, owner=..., ec=..., bytes_transferred=0) at /usr/include/boost/asio/detail/task_io_service_operation.hpp:38
#8 0x00000000004f1d55 in boost::asio::detail::epoll_reactor::descriptor_state::do_complete (owner=0x8084d0, base=0x804140, ec=..., bytes_transferred=1) at /usr/include/boost/asio/detail/impl/epoll_reactor.ipp:651
#9 0x00000000004f0300 in boost::asio::detail::task_io_service_operation::complete (this=0x804140, owner=..., ec=..., bytes_transferred=1) at /usr/include/boost/asio/detail/task_io_service_operation.hpp:38
#10 0x00000000004f2823 in boost::asio::detail::task_io_service::do_run_one (this=0x8084d0, lock=..., this_thread=..., ec=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:372
#11 0x00000000004f23a1 in boost::asio::detail::task_io_service::run (this=0x8084d0, ec=...) at /usr/include/boost/asio/detail/impl/task_io_service.ipp:149
#12 0x00000000004f2abc in boost::asio::io_service::run (this=0x7ef540) at /usr/include/boost/asio/impl/io_service.ipp:59
#13 0x00000000004f7c89 in MaNGOS::Listener<AuthSocket>::Listener(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)::{lambda()#1}::operator()() const () at /home/ubuntu/MoltenCore/MoltenCore/src/shared/Network/Listener.hpp:84
#14 0x0000000000505624 in std::_Bind_simple<MaNGOS::Listener<AuthSocket>::Listener(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)::{lambda()#1} ()>::_M_invoke<>(std::_Index_tuple<>) (this=0x8049c8)
at /usr/include/c++/5/functional:1531
#15 0x0000000000504f38 in std::_Bind_simple<MaNGOS::Listener<AuthSocket>::Listener(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)::{lambda()#1} ()>::operator()() (this=0x8049c8) at /usr/include/c++/5/functional:1520
#16 0x0000000000504416 in std::thread::_Impl<std::_Bind_simple<MaNGOS::Listener<AuthSocket>::Listener(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)::{lambda()#1} ()> >::_M_run() (this=0x8049b0) at /usr/include/c++/5/thread:115
#17 0x00007ffff6c98c80 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#18 0x00007ffff7bc16ba in start_thread (arg=0x7ffff4ec9700) at pthread_create.c:333
#19 0x00007ffff63fe82d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
EDIT:
NetworkThread.hpp:
template <typename SocketType>
class NetworkThread
{
private:
boost::asio::io_service m_service;
std::mutex m_socketLock;
std::unordered_set<std::shared_ptr<SocketType>> m_sockets;
// note that the work member *must* be declared after the service member for the work constructor to function correctly
std::unique_ptr<boost::asio::io_service::work> m_work;
std::thread m_serviceThread;
public:
NetworkThread() : m_work(new boost::asio::io_service::work(m_service))
{
m_serviceThread = std::thread([this] { boost::system::error_code ec; this->m_service.run(ec); });
}
~NetworkThread()
{
// Allow io_service::run() to exit.
m_work.reset();
m_service.stop();
m_serviceThread.join();
// attempt to gracefully close any open connections
for (auto i = m_sockets.begin(); i != m_sockets.end();)
{
auto const current = i;
++i;
if (!(*current)->IsClosed())
(*current)->Close();
}
}
size_t Size() const { return m_sockets.size(); }
std::shared_ptr<SocketType> CreateSocket();
void RemoveSocket(Socket *socket)
{
std::lock_guard<std::mutex> guard(m_socketLock);
m_sockets.erase(socket->shared<SocketType>());
}
};
template <typename SocketType>
std::shared_ptr<SocketType> NetworkThread<SocketType>::CreateSocket()
{
std::lock_guard<std::mutex> guard(m_socketLock);
auto const i = m_sockets.emplace(std::make_shared<SocketType>(m_service, [this] (Socket *socket) { this->RemoveSocket(socket); }));
return *i.first;
}
The problem is totally different:
In your code:
template <typename SocketType>
void Listener<SocketType>::OnAccept(
NetworkThread<SocketType> *worker,
std::shared_ptr<SocketType> const& socket,
const boost::system::error_code &ec )
{
// at this point, socket has 1 reference count, held by the lambda
// in BeginAccept, its reference count cannot increase, since it's
// constant.
// ...
BeginAccept(); // this creates a new, distinct instance of the lambda
// fuinction object in BeginAccept.
// when we exit, constrol is given back to calling lambda in BeginAccept
// its destructor happily deletes the socket, since its reference count
// is still only 1.
}
Bottom line: OnAccept() needs to receive the socket pointer by value, and it needs to transfer or store this shared pointer somehow. This is usually done
by passing the shared_ptr to BeginReceive() BY VALUE. BeginReceive() must then take the responsibility to keep the socket pointer alive until the connection dies, this, it usually does that by passing the pointer back to itself, either as a parameter, or as a lambda capture, always by value.
The easiest way to fix your code is to move the call to StartAsyncRead() to OnAccept(), since there is a convenient copy of a shared_ptr of the socket there.
I am trying to join the thread using boost and the program seems to wait indefinitely when I do that.
Thread->join();
On the console I see the following output when I break.
Program received signal SIGINT, Interrupt.
pthread_cond_wait##GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185 ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: No such file or directory.
Here is the GDB trace.
#0 pthread_cond_wait##GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
#1 0x00000000004900a3 in boost::condition_variable::wait(boost::unique_lock<boost::mutex>&) () at /usr/local/boost/include/boost/thread/pthread/condition_variable.hpp:73
#2 0x00007ffff724e333 in boost::thread::join_noexcept() () at libs/thread/src/pthread/thread.cpp:316
#3 0x000000000048e135 in LIN::waitForThreads() () at /usr/local/boost/include/boost/thread/detail/thread.hpp:767
#4 0x00000000004882fd in fa::testinit::test_method() () at /home/ubuntu/UnitTest01.cpp:205
#5 0x0000000000488ef1 in fa::testinit_invoker() () at /home/ubuntu/UnitTest01.cpp:173
#6 0x000000000047296b in boost::detail::function::function_obj_invoker0<boost::detail::forward, int>::invoke(boost::detail::function::function_buffer&) ()
at /usr/local/boost/include/boost/function/function_template.hpp:771
#7 0x000000000044aabd in boost::execution_monitor::catch_signals(boost::function<int ()> const&) () at /usr/local/boost/include/boost/function/function_template.hpp:771
#8 0x000000000044ab91 in boost::execution_monitor::execute(boost::function<int ()> const&) () at /usr/local/boost/include/boost/test/impl/execution_monitor.ipp:1207
#9 0x000000000044b2d5 in boost::execution_monitor::vexecute(boost::function<void ()> const&) () at /usr/local/boost/include/boost/test/impl/execution_monitor.ipp:1313
#10 0x0000000000452bb2 in boost::unit_test::unit_test_monitor_t::execute_and_translate(boost::function<void ()> const&, unsigned int) () at /usr/local/boost/include/boost/test/impl/unit_test_monitor.ipp:46
#11 0x0000000000484760 in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int) () at /usr/local/boost/include/boost/test/impl/framework.ipp:685
#12 0x00000000004849ac in boost::unit_test::framework::state::execute_test_tree(unsigned long, unsigned int) () at /usr/local/boost/include/boost/test/impl/framework.ipp:636
#13 0x0000000000460329 in boost::unit_test::framework::run(unsigned long, bool) () at /usr/local/boost/include/boost/test/impl/framework.ipp:636
#14 0x0000000000460957 in boost::unit_test::unit_test_main(boost::unit_test::test_suite* (*)(int, char**), int, char**) () at usr/local/boost/include/boost/test/impl/unit_test_main.ipp:228
#15 0x00007ffff6673aed in __libc_start_main (main=0x4419c0 <main>, argc=1, argv=0x7fffffffe6c8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe6b8) at libc-start.c:269
#16 0x0000000000442ec9 in _start () at ../sysdeps/x86_64/start.S:122
waitForThreads code :
{
stopthread = true;
//wait for Thread 2
boost::mutex::scoped_lock lock(thread2_lock);
lock.unlock();
m_ConditionVariable.notify_one();
m_Thread->join();
}
Thread 2 code:
while(!stopthread){
boost::mutex::scoped_lock lock(thread2_lock);
while (m_Queue.empty())
{
m_ConditionVariable.wait(lock);
}
if (!m_Queue.empty()){
struct queue_output out;
out = m_Queue.front();
m_Queue.pop_front();
boost::mutex::scoped_lock new_lock(another_lock);
if (write(fd, &out, sizeof(struct queue_output)) == -1)
close(out.fd);
}
}
code to update queue:
{
boost::mutex::scoped_lock lock(thread2_lock);
m_Queue.push_back(input);
lock.unlock();
m_ConditionVariable.notify_one();
}
In UnitTest01.cpp, testinit first I am creating the thread, then updating the queue, then calling join.
Can someone please help me understand why it is hanging while thread joining?
Thanks in advance.
I'm using OpenALPR and I have trained the OCR to recognize Mandatory font. When I try to use that traineddata, alpr exits with segmentation fault.
I'm using version 1.2.0 and tesseract 3.03, with leptonica-1.71
When I run it with gdb, I get the following stack trace:
(gdb) bt
#0 0x00007ffff67ded7b in tesseract::Classify::ComputeCharNormArrays(FEATURE_STRUCT*, INT_TEMPLATES_STRUCT*, unsigned char*, unsigned char*) () from /usr/local/lib/libtesseract.so.3
#1 0x00007ffff67e3b6b in tesseract::Classify::CharNormTrainingSample(bool, int, tesseract::TrainingSample const&, GenericVector<tesseract::UnicharRating>*) () from /usr/local/lib/libtesseract.so.3
#2 0x00007ffff6806882 in tesseract::TessClassifier::UnicharClassifySample(tesseract::TrainingSample const&, Pix*, int, int, GenericVector<tesseract::UnicharRating>*) () from /usr/local/lib/libtesseract.so.3
#3 0x00007ffff67e1b22 in tesseract::Classify::CharNormClassifier(TBLOB*, tesseract::TrainingSample const&, ADAPT_RESULTS*) () from /usr/local/lib/libtesseract.so.3
#4 0x00007ffff67e1c95 in tesseract::Classify::DoAdaptiveMatch(TBLOB*, ADAPT_RESULTS*) () from /usr/local/lib/libtesseract.so.3
#5 0x00007ffff67e1f24 in tesseract::Classify::AdaptiveClassifier(TBLOB*, BLOB_CHOICE_LIST*) () from /usr/local/lib/libtesseract.so.3
#6 0x00007ffff67d993d in tesseract::Wordrec::call_matcher(TBLOB*) () from /usr/local/lib/libtesseract.so.3
#7 0x00007ffff67d9986 in tesseract::Wordrec::classify_blob(TBLOB*, char const*, C_COL, BlamerBundle*) () from /usr/local/lib/libtesseract.so.3
#8 0x00007ffff67d6bab in tesseract::Wordrec::classify_piece(GenericVector<SEAM*> const&, short, short, char const*, TWERD*, BlamerBundle*) () from /usr/local/lib/libtesseract.so.3
#9 0x00007ffff67c808d in tesseract::Wordrec::chop_word_main(WERD_RES*) () from /usr/local/lib/libtesseract.so.3
#10 0x00007ffff67d9821 in tesseract::Wordrec::cc_recog(WERD_RES*) () from /usr/local/lib/libtesseract.so.3
#11 0x00007ffff6716e62 in tesseract::Tesseract::recog_word_recursive(WERD_RES*) () from /usr/local/lib/libtesseract.so.3
#12 0x00007ffff6716ff5 in tesseract::Tesseract::recog_word(WERD_RES*) () from /usr/local/lib/libtesseract.so.3
#13 0x00007ffff6708160 in tesseract::Tesseract::tess_segment_pass_n(int, WERD_RES*) () from /usr/local/lib/libtesseract.so.3
#14 0x00007ffff66cf2a5 in tesseract::Tesseract::match_word_pass_n(int, WERD_RES*, ROW*, BLOCK*) () from /usr/local/lib/libtesseract.so.3
#15 0x00007ffff66cf482 in tesseract::Tesseract::classify_word_pass1(tesseract::WordData*, WERD_RES*) () from /usr/local/lib/libtesseract.so.3
#16 0x00007ffff66d26d6 in tesseract::Tesseract::classify_word_and_language(void (tesseract::Tesseract::*)(tesseract::WordData*, WERD_RES*), tesseract::WordData*) () from /usr/local/lib/libtesseract.so.3
#17 0x00007ffff66d2dea in tesseract::Tesseract::RecogAllWordsPassN(int, ETEXT_DESC*, GenericVector<tesseract::WordData>*) () from /usr/local/lib/libtesseract.so.3
#18 0x00007ffff66d3701 in tesseract::Tesseract::recog_all_words(PAGE_RES*, ETEXT_DESC*, TBOX const*, char const*, int) () from /usr/local/lib/libtesseract.so.3
#19 0x00007ffff66c203d in tesseract::TessBaseAPI::Recognize(ETEXT_DESC*) () from /usr/local/lib/libtesseract.so.3
#20 0x00000000004aadf4 in OCR::performOCR (this=0x93d7c0, pipeline_data=0x7fffe0a3a9b0) at /opt/openalpr/src/openalpr/ocr.cpp:79
#21 0x000000000048845b in plateAnalysisThread (arg=0x7fffffffd380) at /opt/openalpr/src/openalpr/alpr_impl.cpp:261
#22 0x00000000004df217 in tthread::thread::wrapper_function (aArg=0x93d210) at /opt/openalpr/src/openalpr/support/tinythread.cpp:169
#23 0x00007ffff6401182 in start_thread (arg=0x7fffe0a3b700) at pthread_create.c:312
#24 0x00007ffff590e00d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
I was debugging tesseract when I saw that the error occurs because shape_table_->getShape(id) was being called with id >= to shape_table_'s size, on file adaptmatch.cpp.
As a workaround, I changed the code to check the size first and skip the iteration instead of exit with segfault.
It is possible that this workaround will have undesirable consequences, but at least it stopped breaking. Here is the diff:
diff --git a/classify/adaptmatch.cpp b/classify/adaptmatch.cpp
index 0eaf144..b21d980 100644
--- a/classify/adaptmatch.cpp
+++ b/classify/adaptmatch.cpp
## -1148,7 +1148,7 ## void Classify::ExpandShapesAndApplyCorrections(
fontinfo_id = ClassAndConfigIDToFontOrShapeID(class_id, int_result.Config);
fontinfo_id2 = ClassAndConfigIDToFontOrShapeID(class_id,
int_result.Config2);
- if (shape_table_ != NULL) {
+ if (shape_table_ != NULL && fontinfo_id < shape_table_->NumShapes()) {
// Actually fontinfo_id is an index into the shape_table_ and it
// contains a list of unchar_id/font_id pairs.
int shape_id = fontinfo_id;
## -1781,10 +1781,12 ## void Classify::ComputeCharNormArrays(FEATURE_STRUCT* norm_feature,
int font_set_id = templates->Class[id]->font_set_id;
const FontSet &fs = fontset_table_.get(font_set_id);
for (int config = 0; config < fs.size; ++config) {
- const Shape& shape = shape_table_->GetShape(fs.configs[config]);
- for (int c = 0; c < shape.size(); ++c) {
- if (char_norm_array[shape[c].unichar_id] < pruner_array[id])
- pruner_array[id] = char_norm_array[shape[c].unichar_id];
+ if (shape_table_->NumShapes() > fs.configs[config]) {
+ const Shape shape = shape_table_->GetShape(fs.configs[config]);
+ for (int c = 0; c < shape.size(); ++c) {
+ if (char_norm_array[shape[c].unichar_id] < pruner_array[id])
+ pruner_array[id] = char_norm_array[shape[c].unichar_id];
+ }
}
}
}
I am trying to run blocking_udp_echo_client on MacOS X
http://www.boost.org/doc/libs/1_35_0/doc/html/boost_asio/example/echo/blocking_udp_echo_client.cpp
I run it with argument 'localhost 9000'
But the program crashes and this is the line in the source which crashes:
`udp::socket s(io_service, udp::endpoint(udp::v4(), 0));'
this is the stack trace:
#0 0x918c3e42 in __kill
#1 0x918c3e34 in kill$UNIX2003
#2 0x9193623a in raise
#3 0x91942679 in abort
#4 0x940d96f9 in __gnu_debug::_Error_formatter::_M_error
#5 0x0000e76e in
__gnu_debug::_Safe_iterator::op_base*> >,
__gnu_debug_def::list::op_base*>,
std::allocator::op_base*> > >
>::_Safe_iterator at safe_iterator.h:124
#6 0x00014729 in boost::asio::detail::hash_map::op_base*>::bucket_type::bucket_type
at hash_map.hpp:277
#7 0x00019e97 in std::_Construct::op_base*>::bucket_type,
boost::asio::detail::hash_map::op_base*>::bucket_type> at
stl_construct.h:81
#8 0x0001a457 in
std::__uninitialized_fill_n_aux::op_base*>::bucket_type*,
__gnu_norm::vector::op_base*>::bucket_type,
std::allocator::op_base*>::bucket_type> >
>, unsigned long, boost::asio::detail::hash_map::op_base*>::bucket_type> at
stl_uninitialized.h:194
#9 0x0001a4e1 in
std::uninitialized_fill_n::op_base*>::bucket_type*,
__gnu_norm::vector::op_base*>::bucket_type,
std::allocator::op_base*>::bucket_type> >
>, unsigned long, boost::asio::detail::hash_map::op_base*>::bucket_type> at
stl_uninitialized.h:218
#10 0x0001a509 in
std::__uninitialized_fill_n_a::op_base*>::bucket_type*,
__gnu_norm::vector::op_base*>::bucket_type,
std::allocator::op_base*>::bucket_type> >
>, unsigned long, boost::asio::detail::hash_map::op_base*>::bucket_type,
boost::asio::detail::hash_map::op_base*>::bucket_type> at
stl_uninitialized.h:310
#11 0x0001aa34 in
__gnu_norm::vector::op_base*>::bucket_type,
std::allocator::op_base*>::bucket_type>
>::_M_fill_insert at vector.tcc:365
#12 0x0001acda in
__gnu_norm::vector::op_base*>::bucket_type,
std::allocator::op_base*>::bucket_type>
>::insert at stl_vector.h:658
#13 0x0001ad81 in
__gnu_norm::vector::op_base*>::bucket_type,
std::allocator::op_base*>::bucket_type>
>::resize at stl_vector.h:427
#14 0x0001ae3a in
__gnu_debug_def::vector::op_base*>::bucket_type,
std::allocator::op_base*>::bucket_type>
>::resize at vector:169
#15 0x0001b7be in boost::asio::detail::hash_map::op_base*>::rehash at
hash_map.hpp:221
#16 0x0001bbeb in boost::asio::detail::hash_map::op_base*>::hash_map at
hash_map.hpp:67
#17 0x0001bc74 in
boost::asio::detail::reactor_op_queue::reactor_op_queue at
reactor_op_queue.hpp:42
#18 0x0001bd24 in
boost::asio::detail::kqueue_reactor::kqueue_reactor at
kqueue_reactor.hpp:86
#19 0x0001c000 in
boost::asio::detail::service_registry::use_service
> at service_registry.hpp:109
#20 0x0001c14d in
boost::asio::use_service >
at io_service.ipp:195
#21 0x0001c26d in
boost::asio::detail::reactive_socket_service >::reactive_socket_service
at reactive_socket_service.hpp:111
#22 0x0001c344 in
boost::asio::detail::service_registry::use_service > > at
service_registry.hpp:109
#23 0x0001c491 in
boost::asio::use_service > > at io_service.ipp:195
#24 0x0001c4d5 in
boost::asio::datagram_socket_service::datagram_socket_service
at datagram_socket_service.hpp:95
#25 0x0001c59e in
boost::asio::detail::service_registry::use_service
> at service_registry.hpp:109
#26 0x0001c6eb in
boost::asio::use_service
> at io_service.ipp:195
#27 0x0001c711 in
boost::asio::basic_io_object
>::basic_io_object at basic_io_object.hpp:72
#28 0x0001c783 in boost::asio::basic_socket
>::basic_socket at basic_socket.hpp:108
#29 0x0001c865 in
boost::asio::basic_datagram_socket
>::basic_datagram_socket at basic_datagram_socket.hpp:107
#30 0x000027bc in main at main.cpp:32
This is the gdb output:
(gdb) continue
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127:
error: attempt to copy-construct an iterator from a singular iterator.
Objects involved in the operation:
iterator "this" # 0x0x100420 {
type = N11__gnu_debug14_Safe_iteratorIN10__gnu_norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEEN15__gnu_debug_def4listISB_SaISB_EEEEE
(mutable iterator);
state = singular;
}
iterator "other" # 0x0xbfffe8a4 {
type = N11__gnu_debug14_Safe_iteratorIN10__gnu_norm14_List_iteratorISt4pairIiPN5boost4asio6detail16reactor_op_queueIiE7op_baseEEEEN15__gnu_debug_def4listISB_SaISB_EEEEE
(mutable iterator);
state = singular;
}
Program received signal: “SIGABRT”.
(gdb) continue
Program received signal: “?”.
Does someone has any idea why this example does not work on mac osx?
Thank you.
Looks like a bug in the boost::asio library. Here is the corresponding bug report.