Irit Katriel added the comment:
This is a duplicate of bpo-45924. The traceback accumulates another frame
every time the exception is raised. To see that, change main in your script to
async def main():
task = asyncio.create_task(task_that_raise())
while True:
try:
New submission from David M. :
Awaiting multiple times on a single task that failed with an exception results
in an unbounded increase in memory usage. Enough repeated "await"s of the task
can result in an OOM.
The same pattern on a task that didn't raise an exception behaves as expected.