[Python-checkins] bpo-23846: Fix ProactorEventLoop._write_to_self() (GH-11566)

Victor Stinner webhook-mailer at python.org
Tue Jan 15 07:58:44 EST 2019


https://github.com/python/cpython/commit/c9f872b0bdce5888f1879fa74e098bf4a05430c5
commit: c9f872b0bdce5888f1879fa74e098bf4a05430c5
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-01-15T13:58:38+01:00
summary:

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().

files:
A Misc/NEWS.d/next/Library/2019-01-15-13-31-30.bpo-23846.LT_qL8.rst
M Lib/asyncio/proactor_events.py

diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py
index 3a1826e2c0d2..a849be1cc147 100644
--- a/Lib/asyncio/proactor_events.py
+++ b/Lib/asyncio/proactor_events.py
@@ -636,7 +636,13 @@ def _loop_self_reading(self, f=None):
             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,
diff --git a/Misc/NEWS.d/next/Library/2019-01-15-13-31-30.bpo-23846.LT_qL8.rst b/Misc/NEWS.d/next/Library/2019-01-15-13-31-30.bpo-23846.LT_qL8.rst
new file mode 100644
index 000000000000..788f092df9c1
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-01-15-13-31-30.bpo-23846.LT_qL8.rst
@@ -0,0 +1,2 @@
+:class:`asyncio.ProactorEventLoop` now catchs and logs send errors when the
+self-pipe is full.



More information about the Python-checkins mailing list