cppcoro icon indicating copy to clipboard operation
cppcoro copied to clipboard

Fix segfaults in test 37

Open karzhenkov opened this issue 4 years ago • 1 comments

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.

karzhenkov avatar Jan 10 '21 16:01 karzhenkov

Almost all test configurations have a large depth of nested continuation calls (see, for example, here)

karzhenkov avatar Jan 10 '21 18:01 karzhenkov