bpo-23846: Fix ProactorEventLoop._write_to_self() (GH-11566)

asyncio.ProactorEventLoop now catchs and logs send errors when the
self-pipe is full: BaseProactorEventLoop._write_to_self() now catchs
and logs OSError exceptions, as done by
BaseSelectorEventLoop._write_to_self().
This commit is contained in:
Victor Stinner 2019-01-15 13:58:38 +01:00 committed by GitHub
parent 3607ef43c4
commit c9f872b0bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -636,7 +636,13 @@ class BaseProactorEventLoop(base_events.BaseEventLoop):
f.add_done_callback(self._loop_self_reading)
def _write_to_self(self):
self._csock.send(b'\0')
try:
self._csock.send(b'\0')
except OSError:
if self._debug:
logger.debug("Fail to write a null byte into the "
"self-pipe socket",
exc_info=True)
def _start_serving(self, protocol_factory, sock,
sslcontext=None, server=None, backlog=100,

View File

@ -0,0 +1,2 @@
:class:`asyncio.ProactorEventLoop` now catchs and logs send errors when the
self-pipe is full.