asio icon indicating copy to clipboard operation
asio copied to clipboard

segfault in yield_context when BOOST_USE_VALGRIND is defined

Open ghost opened this issue 5 years ago • 1 comments

@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.

ghost avatar Dec 30 '20 01:12 ghost

We also face this issue on x86-64 with clang14.

Is there any plan to fix this?

sandro97git avatar Jan 30 '24 09:01 sandro97git