changeset 40788:41f0529b5112 stable

commandserver: get around ETIMEDOUT raised by selectors2 selector.select() should exits with an empty event list on timed out, but selectors2 raises OSError if timeout expires while recovering from EINTR. Spotted while debugging new chg feature.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 03 Dec 2018 21:45:15 +0900
parents d1bda397df73
children 8ff910b21eef
files mercurial/commandserver.py
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commandserver.py	Mon Dec 03 21:31:19 2018 +0900
+++ b/mercurial/commandserver.py	Mon Dec 03 21:45:15 2018 +0900
@@ -472,7 +472,15 @@
                 # waiting for recv() will receive ECONNRESET.
                 self._unlinksocket()
                 exiting = True
-            ready = selector.select(timeout=h.pollinterval)
+            try:
+                ready = selector.select(timeout=h.pollinterval)
+            except OSError as inst:
+                # selectors2 raises ETIMEDOUT if timeout exceeded while
+                # handling signal interrupt. That's probably wrong, but
+                # we can easily get around it.
+                if inst.errno != errno.ETIMEDOUT:
+                    raise
+                ready = []
             if not ready:
                 # only exit if we completed all queued requests
                 if exiting: