Open 0x0badc0de opened 11 months ago
Aren't you spawning the thing onto the system_executor?
If I enable handle tracking and print ioc
address on the begging, following is printed:
ioc=0x7ffc7cd95490
@asio|1698406999.105721|0*1|io_context@0x7ffc7cd95490.execute
@asio|1698406999.105760|0^2|in 'co_spawn_entry_point' (/usr/include/boost/asio/impl/co_spawn.hpp:188)
@asio|1698406999.105760|0*2|io_context@0x7ffc7cd95490.execute
@asio|1698406999.105770|0*3|io_context@0x7ffc7cd95490.execute
@asio|1698406999.105775|>1|
Foo 1
@asio|1698406999.105801|1*4|deadline_timer@0x55d37d75c910.async_wait
@asio|1698406999.105809|<1|
@asio|1698406999.105812|>2|
Foo 2
@asio|1698406999.105820|2*5|deadline_timer@0x55d37d75ce48.async_wait
@asio|1698406999.105824|<2|
@asio|1698406999.105827|>3|
Foo 3
@asio|1698406999.105834|3*6|deadline_timer@0x55d37d75d020.async_wait
@asio|1698406999.105840|<3|
@asio|1698407004.106107|>6|ec=system:0
@asio|1698407004.106147|6|deadline_timer@0x55d37d75d020.cancel
~Foo 3
@asio|1698407004.106163|6*7|io_context@0x7ffc7cd95490.execute
@asio|1698407004.106168|<6|
@asio|1698407004.106176|5*8|io_context@0x7ffc7cd95490.execute
@asio|1698407004.106179|~5|
@asio|1698407004.106182|~4|
@asio|1698407004.106187|7*9|io_context@0x7ffc7cd95490.execute
@asio|1698407004.106190|~7|
@asio|1698407004.106221|8|deadline_timer@0x55d37d75ce48.cancel
~Foo 2
@asio|1698407004.106227|~8|
@asio|1698407004.106231|~9|
Local io_context
only and deadline_times, no mentions of system executor.
Oh right, it doesn't register the spawned coro into a service, so in that case it may leak. I'll take a look, that's a legit bug.
Boost-1.83, gcc-13.2
If
io_context
executingexperimental::coro
is stopped, coro stack is not unwound, memory is not freed. Whileawaitable
does it as expected.Following code:
Outputs:
While I'd expect it to output
https://godbolt.org/z/PxKo87vW7