asio
asio copied to clipboard
segfault in yield_context when BOOST_USE_VALGRIND is defined
@cspanier commented on Jul 19, 2019, 7:30 AM UTC:
The following code crashes on Linux when BOOST_USE_VALGRIND is defined:
#include <boost/asio.hpp>
#include <boost/asio/spawn.hpp>
int main(int /*argc*/, char* /*argv*/[])
{
boost::asio::io_context context;
boost::asio::high_resolution_timer timer(context, std::chrono::seconds(1));
boost::asio::spawn(context, [&](boost::asio::yield_context yield) {
// The following line crashes in jump_fcontext while yielding the coro, but
// only if BOOST_USE_VALGRIND is defined:
timer.async_wait(yield);
});
context.run();
return 0;
}
g++ -DBOOST_USE_VALGRIND main.cpp -lboost_coroutine -lboost_context -lpthread -o test && ./test
The issue happens both with GCC 9.1.0 and Clang 8.0.0 on x86_64 (tested on Arch and Debian), and on aarch64 (RaspberryPi 3) running Arch in 64bit mode.
I know that spawn.hpp still makes use of deprecated Boost::Coroutines V1.
This issue was moved by chriskohlhoff from boostorg/asio#262.
We also face this issue on x86-64 with clang14.
Is there any plan to fix this?