diff options
author | Ben Darnell <ben@bendarnell.com> | 2020-08-31 19:57:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-31 19:57:52 (GMT) |
commit | ea5a6363c3f8cc90b7c0cc573922b10f296073b6 (patch) | |
tree | 9464334a7c5d9f0b5dc76a227b915a9850d05c90 /Lib/asyncio/windows_events.py | |
parent | c3a651ad2544d7d1be389b63e9a4a58a92a31623 (diff) | |
download | cpython-ea5a6363c3f8cc90b7c0cc573922b10f296073b6.zip cpython-ea5a6363c3f8cc90b7c0cc573922b10f296073b6.tar.gz cpython-ea5a6363c3f8cc90b7c0cc573922b10f296073b6.tar.bz2 |
bpo-39010: Fix errors logged on proactor loop restart (#22017)
Stopping and restarting a proactor event loop on windows can lead to
spurious errors logged (ConnectionResetError while reading from the
self pipe). This fixes the issue by ensuring that we don't attempt
to start multiple copies of the self-pipe reading loop.
Diffstat (limited to 'Lib/asyncio/windows_events.py')
-rw-r--r-- | Lib/asyncio/windows_events.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/asyncio/windows_events.py b/Lib/asyncio/windows_events.py index a6759b7..5e7cd79 100644 --- a/Lib/asyncio/windows_events.py +++ b/Lib/asyncio/windows_events.py @@ -318,8 +318,12 @@ class ProactorEventLoop(proactor_events.BaseProactorEventLoop): if self._self_reading_future is not None: ov = self._self_reading_future._ov self._self_reading_future.cancel() - # self_reading_future was just cancelled so it will never be signalled - # Unregister it otherwise IocpProactor.close will wait for it forever + # self_reading_future was just cancelled so if it hasn't been + # finished yet, it never will be (it's possible that it has + # already finished and its callback is waiting in the queue, + # where it could still happen if the event loop is restarted). + # Unregister it otherwise IocpProactor.close will wait for it + # forever if ov is not None: self._proactor._unregister(ov) self._self_reading_future = None |