Closed jothalha closed 9 months ago
Might be related to #1348
Sounds like you need to use a strand.
Thanks for the reply! So this seems to fix the problem and the tsan warning:
co_spawn(make_strand(pool), composed(), boost::asio::use_future).get();
Could there be other pitfalls depending on what happens in composed
or other coros? The only problem that I see at the moment would be to spawn a new coro with a different executor somewhere, ie
co_await (foo() || co_spawn(some_executor, [&] () { return timer.async_wait(); }, boost::asio::use_awaitable))
which would circumvent the strand again - or is there a way around that?
We encountered crashes with awaitable operators. This is a reduced (but probably not minimal) example that still fails for me after an indefinite number of loop runs on windows. So far I couldn't reproduce a segfault on linux or with single-threaded execution.
If anyone has some advice on how to better debug it I'm all ears as I'm missing some understanding of what should happen when.
Sample
Compiled with
As an environment we use MSYS2 clang64 with Boost 1.83
Stacktrace
Full stacktrace:
stacktrace.txt