Skip to content

Commit c9f872b

Browse files
authored
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().
1 parent 3607ef4 commit c9f872b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Lib/asyncio/proactor_events.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,13 @@ def _loop_self_reading(self, f=None):
636636
f.add_done_callback(self._loop_self_reading)
637637

638638
def _write_to_self(self):
639-
self._csock.send(b'\0')
639+
try:
640+
self._csock.send(b'\0')
641+
except OSError:
642+
if self._debug:
643+
logger.debug("Fail to write a null byte into the "
644+
"self-pipe socket",
645+
exc_info=True)
640646

641647
def _start_serving(self, protocol_factory, sock,
642648
sslcontext=None, server=None, backlog=100,
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:class:`asyncio.ProactorEventLoop` now catchs and logs send errors when the
2+
self-pipe is full.

0 commit comments

Comments
 (0)