You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I build this code with g++13 & libstdc++ on Ubuntu 22.04.
The output of this program is the following:
long_loop: flag is 1
long_loop: flag is 0
long_loop: flag is 0
long_loop: flag is 0
long_loop: flag is 0
[...]
As we can see, the loop accesses the global flag after the set_global_flag object is destroyed (the flag is reset to 0), which means that the long_loop_task coroutine has been resumed after the co_main function returned. In this program, nothing much happens, but in my original code, the flag was a pointer passed by reference to the loop and the set_global_flag was a unique_ptr, which caused the loop to access through the reference an object that was destroyed.
The program never terminates, even if an interrupt (Ctrl+C) or termination (SIGTERM) signal is sent. I have to kill it with a SIGKILL or SIGQUIT.
I understand that according to cobalt::race specification, the loop task should not be cancelled, because it is passed by lvalue-reference. It is however surprising to me that it is resumed though, even after the task object was destroyed.
Am I missing something ?
Thank you in advance.
The text was updated successfully, but these errors were encountered:
Hello,
I've been using Cobalt with Boost 1.86.0, and I've had an issue with my code that caused it to segfault due to use of destroyed resources.
I've reproduced my issue on a smaller sample code:
I build this code with g++13 & libstdc++ on Ubuntu 22.04.
The output of this program is the following:
As we can see, the loop accesses the global flag after the
set_global_flag
object is destroyed (the flag is reset to 0), which means that the long_loop_task coroutine has been resumed after the co_main function returned. In this program, nothing much happens, but in my original code, the flag was a pointer passed by reference to the loop and theset_global_flag
was aunique_ptr
, which caused the loop to access through the reference an object that was destroyed.The program never terminates, even if an interrupt (Ctrl+C) or termination (SIGTERM) signal is sent. I have to kill it with a SIGKILL or SIGQUIT.
I understand that according to
cobalt::race
specification, the loop task should not be cancelled, because it is passed by lvalue-reference. It is however surprising to me that it is resumed though, even after the task object was destroyed.Am I missing something ?
Thank you in advance.
The text was updated successfully, but these errors were encountered: