[issue30423] [asyncio] orphan future close loop and cause "RuntimeError: Event loop stopped before Future completed."

Jimmy Lai report at bugs.python.org
Sun May 21 09:44:28 EDT 2017


New submission from Jimmy Lai:

Problem:
"RuntimeError: Event loop stopped before Future completed." throws when calling run_until_complete().

We investigate and find out some orphan futures stay in the event loop before we run another run_until_complete(another_async_func()).
The orphan future has pending state and is attached with _run_until_complete_cb from previous run_until_complete.
It happens because the orphan future thrown Exception and then raise, thus remove_done_callback(_run_until_complete_cb) didn't called.
Move it to finally section can fix it.
With this patch, we stop seeing the Runtime Error.

----------
components: asyncio
messages: 294102
nosy: jimmylai, yselivanov
priority: normal
pull_requests: 1795
severity: normal
status: open
title: [asyncio] orphan future close loop and cause "RuntimeError: Event loop stopped before Future completed."
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30423>
_______________________________________


More information about the Python-bugs-list mailing list