This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 8dc796d49934b2ea3b01dcc794461827696339ce
Author: Andrew Stitcher <[email protected]>
AuthorDate: Fri Jan 25 16:04:28 2019 -0500

    PROTON-1992: [Python] Cope with select being interrupted.
    - Ignore interrupted select syscalls
    -- We do this as the dispatch systems tests use proton calls in a signal 
handler
    -- It's not clear to me that uis actually allowed - it wouldn't be in raw C
    - So it's not entirely clear this is the correct way to go or that the
      code that causes this issue doesn't need fixinf itself!
---
 python/proton/_io.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/python/proton/_io.py b/python/proton/_io.py
index 401ba11..9aa674e 100644
--- a/python/proton/_io.py
+++ b/python/proton/_io.py
@@ -19,6 +19,7 @@
 
 from __future__ import absolute_import
 
+import errno
 import socket
 import select
 import time
@@ -128,7 +129,15 @@ class IO(object):
 
                 return IO.select(r, w, [], t)
 
-            r, w, _ = select_inner(timeout)
+            # Need to allow for signals interrupting us on Python 2
+            # In this case the signal handler could have messed up our 
internal state
+            # so don't retry just return with no handles.
+            try:
+                r, w, _ = select_inner(timeout)
+            except select.error as e:
+                if e[0] != errno.EINTR:
+                    raise
+                r, w = ([], [])
 
             # Calculate timed out selectables
             now = time.time()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to