ROOT: Segmentation violation - c++

I am running Cern ROOT 6.22/00 on Ubuntu 18.04. I am running a very simple code that reads data and plots a graph.
// filename.C Example of graph with SetPoint
{
g = new TGraph();
for(i=0; i<10; i++) {
g->SetPoint(i, i, i*i - 4*i + 7);
}
g->SetMarkerStyle(22);
g->Draw("ALP");
}
When I go ahead and execute the code with .x filename.C, the code works as intended. However, when I run the same command again, I get the segmentation error:
*** Break *** segmentation violation
===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f7c2e7166e7 in waitpid () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007f7c2e681107 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007f7c2f2b8ed3 in TUnixSystem::StackTrace() () from /home/nick/root/lib/libCore.so.6.22
#3 0x00007f7c2f2bb9c5 in TUnixSystem::DispatchSignals(ESignals) () from /home/nick/root/lib/libCore.so.6.22
#4 <signal handler called>
#5 0x00007f7c29f24393 in (anonymous namespace)::ScalarExprEmitter::EmitScalarConversion(llvm::Value*, clang::QualType, clang::QualType, clang::SourceLocation, bool) () from /home/nick/root/lib/libCling.so
#6 0x00007f7c29f25e84 in clang::CodeGen::CodeGenFunction::EmitScalarConversion(llvm::Value*, clang::QualType, clang::QualType, clang::SourceLocation) () from /home/nick/root/lib/libCling.so
#7 0x00007f7c29eed6e0 in clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*) () from /home/nick/root/lib/libCling.so
#8 0x00007f7c29d70dc3 in clang::CodeGen::CodeGenFunction::EmitForStmt(clang::ForStmt const&, llvm::ArrayRef<clang::Attr const*>) () from /home/nick/root/lib/libCling.so
#9 0x00007f7c29d6f305 in clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) () from /home/nick/root/lib/libCling.so
#10 0x00007f7c29d6f42f in clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) () from /home/nick/root/lib/libCling.so
#11 0x00007f7c29daab12 in clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) () from /home/nick/root/lib/libCling.so
#12 0x00007f7c29dc8098 in clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) () from /home/nick/root/lib/libCling.so
#13 0x00007f7c29dea828 in clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) () from /home/nick/root/lib/libCling.so
#14 0x00007f7c29debb05 in clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) () from /home/nick/root/lib/libCling.so
#15 0x00007f7c29dec46f in clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) () from /home/nick/root/lib/libCling.so
#16 0x00007f7c29d2edfd in clang::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) () from /home/nick/root/lib/libCling.so
#17 0x00007f7c2a07aba0 in clang::MultiplexConsumer::HandleTopLevelDecl(clang::DeclGroupRef) () from /home/nick/root/lib/libCling.so
#18 0x00007f7c29ca5aea in cling::DeclCollector::HandleTopLevelDecl(clang::DeclGroupRef) () from /home/nick/root/lib/libCling.so
#19 0x00007f7c29c72bec in cling::IncrementalParser::ParseInternal(llvm::StringRef) () from /home/nick/root/lib/libCling.so
#20 0x00007f7c29c7540c in cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) () from /home/nick/root/lib/libCling.so
#21 0x00007f7c29bf36ad in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /home/nick/root/lib/libCling.so
#22 0x00007f7c29bf3aaa in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) () from /home/nick/root/lib/libCling.so
#23 0x00007f7c29cb50df in cling::MetaProcessor::readInputFromFile(llvm::StringRef, cling::Value*, unsigned long, bool) () from /home/nick/root/lib/libCling.so
#24 0x00007f7c29b6e004 in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /home/nick/root/lib/libCling.so
#25 0x00007f7c29b6eaa2 in TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /home/nick/root/lib/libCling.so
#26 0x00007f7c2f15cba8 in TApplication::ExecuteFile(char const*, int*, bool) () from /home/nick/root/lib/libCore.so.6.22
#27 0x00007f7c2f15c3d0 in TApplication::ProcessLine(char const*, bool, int*) () from /home/nick/root/lib/libCore.so.6.22
#28 0x00007f7c2f6d9002 in TRint::ProcessLineNr(char const*, char const*, int*) () from /home/nick/root/lib/libRint.so.6.22
#29 0x00007f7c2f6d93f4 in TRint::HandleTermInput() () from /home/nick/root/lib/libRint.so.6.22
#30 0x00007f7c2f2bacb0 in TUnixSystem::CheckDescriptors() () from /home/nick/root/lib/libCore.so.6.22
#31 0x00007f7c2f2bc668 in TUnixSystem::DispatchOneEvent(bool) () from /home/nick/root/lib/libCore.so.6.22
#32 0x00007f7c2f1c7751 in TSystem::Run() () from /home/nick/root/lib/libCore.so.6.22
#33 0x00007f7c2f159e7f in TApplication::Run(bool) () from /home/nick/root/lib/libCore.so.6.22
#34 0x00007f7c2f6da9f1 in TRint::Run(bool) () from /home/nick/root/lib/libRint.so.6.22
#35 0x000055f5d5017a3c in main ()
===========================================================
The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum http://root.cern.ch/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at http://root.cern.ch/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#5 0x00007f7c29f24393 in (anonymous namespace)::ScalarExprEmitter::EmitScalarConversion(llvm::Value*, clang::QualType, clang::QualType, clang::SourceLocation, bool) () from /home/nick/root/lib/libCling.so
#6 0x00007f7c29f25e84 in clang::CodeGen::CodeGenFunction::EmitScalarConversion(llvm::Value*, clang::QualType, clang::QualType, clang::SourceLocation) () from /home/nick/root/lib/libCling.so
#7 0x00007f7c29eed6e0 in clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*) () from /home/nick/root/lib/libCling.so
#8 0x00007f7c29d70dc3 in clang::CodeGen::CodeGenFunction::EmitForStmt(clang::ForStmt const&, llvm::ArrayRef<clang::Attr const*>) () from /home/nick/root/lib/libCling.so
#9 0x00007f7c29d6f305 in clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) () from /home/nick/root/lib/libCling.so
#10 0x00007f7c29d6f42f in clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) () from /home/nick/root/lib/libCling.so
#11 0x00007f7c29daab12 in clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) () from /home/nick/root/lib/libCling.so
#12 0x00007f7c29dc8098 in clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) () from /home/nick/root/lib/libCling.so
#13 0x00007f7c29dea828 in clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) () from /home/nick/root/lib/libCling.so
#14 0x00007f7c29debb05 in clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) () from /home/nick/root/lib/libCling.so
#15 0x00007f7c29dec46f in clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) () from /home/nick/root/lib/libCling.so
#16 0x00007f7c29d2edfd in clang::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) () from /home/nick/root/lib/libCling.so
#17 0x00007f7c2a07aba0 in clang::MultiplexConsumer::HandleTopLevelDecl(clang::DeclGroupRef) () from /home/nick/root/lib/libCling.so
#18 0x00007f7c29ca5aea in cling::DeclCollector::HandleTopLevelDecl(clang::DeclGroupRef) () from /home/nick/root/lib/libCling.so
#19 0x00007f7c29c72bec in cling::IncrementalParser::ParseInternal(llvm::StringRef) () from /home/nick/root/lib/libCling.so
#20 0x00007f7c29c7540c in cling::IncrementalParser::Compile(llvm::StringRef, cling::CompilationOptions const&) () from /home/nick/root/lib/libCling.so
#21 0x00007f7c29bf36ad in cling::Interpreter::EvaluateInternal(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /home/nick/root/lib/libCling.so
#22 0x00007f7c29bf3aaa in cling::Interpreter::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cling::Value*, cling::Transaction**, bool) () from /home/nick/root/lib/libCling.so
#23 0x00007f7c29cb50df in cling::MetaProcessor::readInputFromFile(llvm::StringRef, cling::Value*, unsigned long, bool) () from /home/nick/root/lib/libCling.so
===========================================================
I am sure it has nothing to do with my code itself, but ideas to resolve this?

I tried your code on ROOT 6.20/06 and it indeed crashed with the same segmentation errors you posted, but I am able to run your code simply by declaring the types of variables g and i:
{
TGraph* g = new TGraph();
for(int i=0; i<10; i++) {
g->SetPoint(i, i, i*i - 4*i + 7);
}
g->SetMarkerStyle(22);
g->Draw("ALP");
}
TGraph::SetPoint method can itself handle the memory allocation issue, so the code has no problem in principle, just need to be careful when declaring variables in C/C++.

Related

How to debug a sycl runtime compilation that fails with segmentation fault

The point of the question
I have a minimal program that segfaults during sycl runtime compilation. For the sake of detail i have precise reproduction details below. However, the point of this question is to understand how to debug this. It took me a long time to make the minimal example. I suspect if i could get the runtimes for dpcpp i could probably have cut this right down. When the runtime compiler fails, it should throw an exception. I want to know what steps i should take to discover why it is instead segfaulting, and if it is a compiler bug or a bug in my code.
Reproduction details below
starting with the code:
#include <CL/sycl/queue.hpp>
#include <CL/sycl/device.hpp>
#include <CL/sycl/context.hpp>
#include <CL/sycl.hpp>
#include <iostream>
namespace
{
auto is_sign_same(sycl::short3 idx1, sycl::short3 idx2)
{
return (idx1 < 0) == (idx2 < 0);
}
} // namespace
int main()
{
sycl::device device = sycl::device{sycl::gpu_selector{}};
std::cout
<< "\n\nRunning occupancy grid profile. The profile will have the following "
"properties:\n\n Device:\t"
<< device.get_info<sycl::info::device::name>() << "\n\n";
sycl::context context{device};
sycl::property_list properties{sycl::property::queue::enable_profiling()};
sycl::queue queue{device, properties};
auto event = queue.submit(
[](sycl::handler& cgh)
{
// 1. This must be captured or it does not crash. If i put this in the
// kernel, then it does not fail.
sycl::id<3> robot_index{0, 0, 0};
sycl::stream out(1024, 256, cgh);
cgh.parallel_for(
sycl::range<3>{4, 4, 4},
[out, robot_index](sycl::id<3> id)
{
sycl::short3 new_signed_idx{short(0)};
// 2. I cannot remove the subtract between the 2 sycl::short3 here.
// It will not fail.
sycl::short3 old_signed_idx =
sycl::short3{
(short)id.get(0), (short)id.get(1), (short)id.get(2)} -
sycl::short3{
(short)robot_index.get(0),
(short)robot_index.get(1),
(short)robot_index.get(2)};
// 3. I cannot replace this function call with the operation that
// the function performs inline here. It does not fail.
auto s_same = is_sign_same(new_signed_idx, old_signed_idx);
out << s_same;
}
);
}
);
return 0;
}
When compiled using:
/opt/intel/oneapi/compiler/2022.1.0/linux/bin/dpcpp -fclang-abi-compat=7 -fsycl --gcc-toolchain=/usr -sycl-std=2020 -fp-model=precise -Wall -Werror -fsycl -O2 -g -DNDEBUG -std=gnu++17 sgfaulting_file.cpp
will fail at runtime. The failure is a segfault. It is caused by something do do with building the kernel. If we run the output in GDB we get the following stack trace when it dies:
(gdb) where
#0 0x00007f49e3683b8c in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#1 0x00007f49e36b440c in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#2 0x00007f49e36b0dda in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#3 0x00007f49e36b430f in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#4 0x00007f49e36bac6a in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#5 0x00007f49e36b0bed in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#6 0x00007f49e36b430f in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#7 0x00007f49e36bac6a in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#8 0x00007f49e36bf027 in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#9 0x00007f49e36bf908 in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#10 0x00007f49e35ab7bc in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#11 0x00007f49e35abfba in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#12 0x00007f49e35ae90d in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#13 0x00007f49e36ec3d4 in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#14 0x00007f49e35b21fb in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#15 0x00007f49e36ced9a in ?? () from /usr/lib/x86_64-linux-gnu/libigc.so.1
#16 0x00007f49f487f1bb in ?? () from /usr/lib/x86_64-linux-gnu/intel-opencl/libigdrcl.so
#17 0x00007f49f43ef178 in ?? () from /usr/lib/x86_64-linux-gnu/intel-opencl/libigdrcl.so
#18 0x00007f49f4397b33 in ?? () from /usr/lib/x86_64-linux-gnu/intel-opencl/libigdrcl.so
#19 0x00007f49f9327aa4 in cl::sycl::detail::ProgramManager::build(std::unique_ptr<_pi_program, _pi_result (*)(_pi_program*)>, std::shared_ptr<cl::sycl::detail::context_impl>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, _pi_device* const&, std::map<std::pair<cl::sycl::detail::DeviceLibExt, _pi_device*>, _pi_program*, std::less<std::pair<cl::sycl::detail::DeviceLibExt, _pi_device*> >, std::allocator<std::pair<std::pair<cl::sycl::detail::DeviceLibExt, _pi_device*> const, _pi_program*> > >&, unsigned int) () from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#20 0x00007f49f9321336 in cl::sycl::detail::ProgramManager::getBuiltPIProgram(long, std::shared_ptr<cl::sycl::detail::context_impl> const&, std::shared_ptr<cl::sycl::detail::device_impl> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cl::sycl::detail::program_impl const*, bool) () from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#21 0x00007f49f932243c in cl::sycl::detail::ProgramManager::getOrCreateKernel(long, std::shared_ptr<cl::sycl::detail::context_impl> const&, std::shared_ptr<cl::sycl::detail::device_impl> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cl::sycl::detail::program_impl const*) () from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#22 0x00007f49f93630f1 in cl::sycl::detail::enqueueImpKernel(std::shared_ptr<cl::sycl::detail::queue_impl> const&, cl::sycl::detail::NDRDescT&, std::vector<cl::sycl::detail::ArgDesc, std::allocator<cl::sycl::detail::ArgDesc> >&, std::shared_ptr<cl::sycl::detail::kernel_bundle_impl> const&, std::shared_ptr<cl::sycl::detail::kernel_impl> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, long const&, std::vector<_pi_event*, std::allocator<_pi_event*> >&, _pi_event**, std::function<void* (cl::sycl::detail::AccessorImplHost*)> const&) ()
from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#23 0x00007f49f9369f3b in cl::sycl::detail::ExecCGCommand::enqueueImp() ()
from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#24 0x00007f49f93566c5 in cl::sycl::detail::Command::enqueue(cl::sycl::detail::EnqueueResultT&, cl::sycl::detail::BlockingT, std::vector<cl::sycl::detail::Command*, std::allocator<cl::sycl::detail::Command*> >&) () from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#25 0x00007f49f9373b7b in cl::sycl::detail::Scheduler::addCG(std::unique_ptr<cl::sycl::detail::CG, std::default_delete<cl::sycl::detail::CG> >, std::shared_ptr<cl::sycl::detail::queue_impl>) ()
from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#26 0x00007f49f93aef30 in cl::sycl::handler::finalize() ()
from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#27 0x00007f49f93dc3ea in cl::sycl::detail::queue_impl::finalizeHandler(cl::sycl::handler&, cl::sycl::detail::CG::CGTYPE const&, cl::sycl::event&) ()
from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#28 0x00007f49f93dc13b in cl::sycl::detail::queue_impl::submit_impl(std::function<void (cl::sycl::handler&)> const&, std::shared_ptr<cl::sycl::detail::queue_impl> const&, std::shared_ptr<cl::sycl::detail::queue_impl> const&, std::shared_ptr<cl::sycl::detail::queue_impl> const&, cl::sycl::detail::code_location const&, std::function<void (bool, bool, cl::sycl::event&)> const*) ()
from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#29 0x00007f49f93db744 in cl::sycl::detail::queue_impl::submit(std::function<void (cl::sycl::handler&)> const&, std::shared_ptr<cl::sycl::detail::queue_impl> const&, cl::sycl::detail::code_location const&, std:--Type <RET> for more, q to quit, c to continue without paging--
:function<void (bool, bool, cl::sycl::event&)> const*) ()
from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#30 0x00007f49f93db715 in cl::sycl::queue::submit_impl(std::function<void (cl::sycl::handler&)>, cl::sycl::detail::code_location const&) () from /opt/intel/oneapi/compiler/2022.1.0/linux/lib/libsycl.so.5
#31 0x00000000004026d8 in cl::sycl::queue::submit<main::{lambda(cl::sycl::handler&)#1}>(main::{lambda(cl::sycl::handler&)#1}, cl::sycl::detail::code_location const&) (this=0x7ffc5da1b200, CodeLoc=..., CGF=...)
at /opt/intel/oneapi/compiler/2022.1.0/linux/bin-llvm/../include/sycl/CL/sycl/queue.hpp:275
#32 main () at occupancy_grid_point_cloud_creation.cpp:31
The important part being stack position #19:
cl::sycl::detail::ProgramManager::build
The runtime compilation is occurring on the device (from sycl-ls):
[opencl:gpu:2] Intel(R) OpenCL HD Graphics, Intel(R) UHD Graphics [0x9bc4] 3.0 [22.28.23726.1]
if we run the same program but use a host or cpu selector, we do not fail to build and can run successfully. It also seems that if we change minimal details about the program, it also no longer segfaults. These small changes are detailed in the comments in the program.

Crash when sending data using async_write_some

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

How to interpret the template function signature of backtrace in GDB?

The output of backtrace of GDB is pretty messy, especially for template.
For instance:
Thread 2 (LWP 100146 of process 1245):
#0 thr_new () at thr_new.S:3
#1 0x000000080025c3da in _pthread_create (thread=0x7fffdfffd880, attr=<optimized out>, start_routine=0x205500 <void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<void, std::__1::__async_func<func2(std::__1::atomic<long>&)::$_0> >::*)(), std::__1::__async_assoc_state<void, std::__1::__async_func<func2(std::__1::atomic<long>&)::$_0> >*> >(void*)>, arg=0x8007fa8e0) at /usr/src/lib/libthr/thread/thr_create.c:188
#2 0x0000000000204e40 in std::__1::thread::thread<void (std::__1::__async_assoc_state<void, std::__1::__async_func<func2(std::__1::atomic<long>&)::$_0> >::*)(), std::__1::__async_assoc_state<void, std::__1::__async_func<func2(std::__1::atomic<long>&)::$_0> >*, void>(void (std::__1::__async_assoc_state<void, std::__1::__async_func<func2(std::__1::atomic<long>&)::$_0> >::*&&)(), std::__1::__async_assoc_state<void, std::__1::__async_func<func2(std::__1::atomic<long>&)::$_0> >*&&) ()
#3 0x0000000000204309 in std::__1::future<void> std::__1::__make_async_assoc_state<void, std::__1::__async_func<func2(std::__1::atomic<long>&)::$_0> >(std::__1::__async_func<func2(std::__1::atomic<long>&)::$_0>&&) ()
#4 0x00000000002035ea in std::__1::future<std::__1::__invoke_of<std::__1::decay<func2(std::__1::atomic<long>&)::$_0>::type>::type> std::__1::async<func2(std::__1::atomic<long>&)::$_0>(std::__1::launch, func2(std::__1::atomic<long>&)::$_0&&) ()
#5 0x0000000000203462 in func2(std::__1::atomic<long>&) ()
#6 0x0000000000206f18 in main::$_1::operator()() const ()
#7 0x0000000000206eed in void std::__1::__async_func<main::$_1>::__execute<>(std::__1::__tuple_indices<>) ()
#8 0x0000000000206ea5 in std::__1::__async_func<main::$_1>::operator()() ()
#9 0x0000000000206df3 in std::__1::__async_assoc_state<void, std::__1::__async_func<main::$_1> >::__execute() ()
#10 0x0000000000207183 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (std::__1::__async_assoc_state<void, std::__1::__async_func<main::$_1> >::*)(), std::__1::__async_assoc_state<void, std::__1::__async_func<main::$_1> >*> >(void*) ()
#11 0x000000080025c776 in thread_start (curthread=0x8007de500) at /usr/src/lib/libthr/thread/thr_create.c:292
#12 0x0000000000000000 in ?? ()
Backtrace stopped: Cannot access memory at address 0x7fffdfffe000
In frame #8, there are three pairs of parentheses, std::__1::__async_func<main::$_1>::operator()() () what do they mean exactly?
Frame #8 doesn't have debug info, so GDB can't accurately describe it.
Consider this test case:
struct Foo {
int operator()(void) {
return 1; // line 3
}
};
int main()
{
return Foo()();
}
When compiled with g++ -g t.cc and at breakpoint on line 3, this is what GDB displays:
Breakpoint 1, Foo::operator() (this=0x7fffffffdcff) at t.cc:3
3 return 1;
(gdb) bt
#0 Foo::operator() (this=0x7fffffffdcff) at t.cc:3
#1 0x0000555555555139 in main () at t.cc:10
But compile the same source without -g, set a breakpoint on _ZN3FooclEv, and this is what you will see:
Breakpoint 1, 0x0000555555555140 in Foo::operator()() ()
(gdb) bt
#0 0x0000555555555140 in Foo::operator()() ()
#1 0x0000555555555139 in main ()
The first two sets of parenthesis come from demangling the symbol:
c++filt _ZN3FooclEv
Foo::operator()()
The third set is added by GDB because the symbol being displayed is in the .text section and is assumed to be a function.

OpenALPR exits with segmentation fault with custom traineddata

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];
+ }
}
}
}

Problem in running boost eample blocking_udp_echo_client on MacOSX

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.