cppcoro
cppcoro copied to clipboard
Fix segfaults in test 37
Resolves #25.
The crash is caused by stack overflow. Coroutine contnuations can be nested, and the depth of nesting can exceed the available stack space. Such a nesting occurs if async_auto_reset_event::set is called by startWaiter while some other startAwaiter coroutine is already awaiting on the event.
It's also possible to achieve strict nesting - for example, by activating startSignaller after all startWaiter calls are suspended in the co_await event. If the number of waiters is big enough, then the failure is likely to occur in all test configurations.
Almost all test configurations have a large depth of nested continuation calls (see, for example, here)