qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject [qpid-proton] 06/06: 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!
Date Mon, 25 Feb 2019 18:40:23 GMT
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 <astitcher@apache.org>
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: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message