Skip to content

Commit

Permalink
PROTON-1992: [Python] Cope with select being interrupted.
Browse files Browse the repository at this point in the history
- 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!
  • Loading branch information
astitcher committed Feb 25, 2019
1 parent 46979cf commit 8dc796d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/proton/_io.py
Expand Up @@ -19,6 +19,7 @@

from __future__ import absolute_import

import errno
import socket
import select
import time
Expand Down Expand Up @@ -128,7 +129,15 @@ def select_inner(timeout):

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()
Expand Down

0 comments on commit 8dc796d

Please sign in to comment.