Skip to content

Commit

Permalink
kernel heartbeat does not share zmq context with rest of the app
Browse files Browse the repository at this point in the history
This prevents the heartbeat from ever waiting for the GIL, which
could cause erroneous heartbeat failures.
  • Loading branch information
minrk committed Jan 13, 2012
1 parent 3782b5c commit ad971e3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions IPython/zmq/kernelapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,11 @@ def init_sockets(self):
self.stdin_socket = context.socket(zmq.ROUTER)
self.stdin_port = self._bind_socket(self.stdin_socket, self.stdin_port)
self.log.debug("stdin ROUTER Channel on port: %i"%self.stdin_port)

self.heartbeat = Heartbeat(context, (self.ip, self.hb_port))

# heartbeat doesn't share context, because it mustn't be blocked
# by the GIL, which is accessed by libzmq when freeing zero-copy messages
hb_ctx = zmq.Context()
self.heartbeat = Heartbeat(hb_ctx, (self.ip, self.hb_port))
self.hb_port = self.heartbeat.port
self.log.debug("Heartbeat REP Channel on port: %i"%self.hb_port)

Expand Down

0 comments on commit ad971e3

Please sign in to comment.