]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-23846: Fix ProactorEventLoop._write_to_self() (GH-11566) 11568/head
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 15 Jan 2019 13:17:05 +0000 (05:17 -0800)
committerGitHub <noreply@github.com>
Tue, 15 Jan 2019 13:17:05 +0000 (05:17 -0800)
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 c9f872b0bdce5888f1879fa74e098bf4a05430c5)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
Lib/asyncio/proactor_events.py
Misc/NEWS.d/next/Library/2019-01-15-13-31-30.bpo-23846.LT_qL8.rst [new file with mode: 0644]

index 782c86106bce00b39e2e0e6e657deea6a022b150..a638cceda5e4af7aa7cb3f763d88e1c5387d0726 100644 (file)
@@ -634,7 +634,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,
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 (file)
index 0000000..788f092
--- /dev/null
@@ -0,0 +1,2 @@
+:class:`asyncio.ProactorEventLoop` now catchs and logs send errors when the
+self-pipe is full.