Skip to content

Commit c9f2671

Browse files
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(). (cherry picked from commit c9f872b) Co-authored-by: Victor Stinner <[email protected]>
1 parent d5a6adf commit c9f2671

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
@@ -634,7 +634,13 @@ def _loop_self_reading(self, f=None):
634634
f.add_done_callback(self._loop_self_reading)
635635

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

639645
def _start_serving(self, protocol_factory, sock,
640646
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)