catch asyncio.CancelledError as well as concurrent.futures.CancelledError

as of [bpo-32528](https://bugs.python.org/issue32528), asyncio.CancelledError is
not a subclass of concurrent.futures.CancelledError. This means that if an
asyncio future raises an exception, it won't be caught. Therefore, the
exception will bubble past the try-except within the loop in application_checker,
resulting in done applications not being cleaned up, and the application_checker
task not being queued again.
This commit is contained in:
Patrick Gingras 2020-10-30 22:22:33 -04:00
parent a69723ca3f
commit 7225fa7245
No known key found for this signature in database
GPG Key ID: F56B4E7C84CA0B49

View File

@ -277,7 +277,7 @@ class Server(object):
if application_instance and application_instance.done():
try:
exception = application_instance.exception()
except CancelledError:
except (CancelledError, asyncio.CancelledError):
# Future cancellation. We can ignore this.
pass
else: