Add support for async stack traces to folly::coro::Task coroutines
Summary: Initial diff that adds support for tracing through a chain of folly::coro::Task coroutines. This adds some scaffolding that handles saving/restoring the active AsyncStackFrame when a Task awaits some awaitable type that does not know about AsyncStackFrame objects but also allows awaitables to opt-in to AsyncStackFrame awareness by customising the new `folly::coro::co_withAsyncStack()` CPO. Currently only `Task` and `TaskWithExecutor` awaiters have customised this CPO. Also updated the awaiters for `Task` and `TaskWithExecutor` to handle being awaited from coroutines that are not async-stack aware - in which case they just record a null parent-frame for the Task. The Task's `final_suspend()` then either deactivates or pops the frame depending on whether there was a parent frame recorded. BUG: This change currently breaks the symmetric-transfer stack-overflow avoidance when awaiting synchronously-completing coroutines from an AsyncGenerator or from a BarrierTask (eg. inside collectAll implementations). Reviewed By: andriigrynenko Differential Revision: D24428736 fbshipit-source-id: 5722e511ad10d95198ae70a5afe567d83cb06285
Showing
Please register or sign in to comment