Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZMQ heartbeat channel: catch EINTR exceptions and continue. #4118

Merged
merged 1 commit into from
Aug 27, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions IPython/kernel/zmq/heartbeat.py
Expand Up @@ -12,6 +12,7 @@
# Imports
#-----------------------------------------------------------------------------

import errno
import os
import socket
from threading import Thread
Expand Down Expand Up @@ -52,5 +53,13 @@ def run(self):
self.socket = self.context.socket(zmq.REP)
c = ':' if self.transport == 'tcp' else '-'
self.socket.bind('%s://%s' % (self.transport, self.ip) + c + str(self.port))
zmq.device(zmq.FORWARDER, self.socket, self.socket)

while True:
try:
zmq.device(zmq.FORWARDER, self.socket, self.socket)
except zmq.ZMQError as e:
if e.errno == errno.EINTR:
continue
else:
raise
else:
break