New submission from Michael Hall <[email protected]>:
When using asyncio.run for an asynchronous application utilizing ssl, on
windows using the proactor event loop the application crashes when the loop is
closed, completely skipping a finally block in the process.
This appears to be due to a __del__ method on transports used.
Manual handling of the event loop close while including a brief sleep appears
to work as intended.
Both versions work fine with the selector event loop on linux.
This appears to be a somewhat known issue already, as it's been reported to
aiohttp, however both the traceback, and the differing behavior seem to
indicate this is an issue with the proactor event loop.
(On linux this still emits a resource warning without the sleep)
While I don't mind handling the loop cleanup, it seems like this case should
also emit a resource warning rather than crashing.
If it's decided in which way this should be handled, I'm willing to contribute
to or help test whatever direction the resolution for this should go.
Traceback included below, toy version of the problem attached as code.
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at
0x0000026463039820>
Traceback (most recent call last):
File
"C:\Users\Michael\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py",
line 116, in __del__
self.close()
File
"C:\Users\Michael\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py",
line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File
"C:\Users\Michael\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py",
line 715, in call_soon
self._check_closed()
File
"C:\Users\Michael\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py",
line 508, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
----------
components: asyncio
files: example.py
messages: 359448
nosy: asvetlov, mikeshardmind, yselivanov
priority: normal
severity: normal
status: open
title: asyncio crashes when tearing down the proactor event loop
type: crash
versions: Python 3.8
Added file: https://bugs.python.org/file48829/example.py
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39232>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com