use ROUTER/DEALER socket names instead of XREP/XREQ #758

Merged
merged 1 commit into from Sep 6, 2011

1 participant

@minrk
IPython member

This is principally a big find/replace, but also adjusts the import-check for pyzmq/zmq versions in IPython.zmq and IPython.parallel (allowing for two-digit entries in version comparisons, in case of possible 2.1.10 release).

XREP/XREQ are aliases for ROUTER/DEALER in 0MQ 2.1.x, so there is actually no change in behavior. However, these sockets continue to exist in 3.0 under the ROUTER/DEALER names only. The XREP/XREQ protocols change some in 3.0, and won't work properly with current IPython.

It is likely that once 3.0 is stable (and pyzmq supports it better), we will want to move some sockets back to the new XREP/XREQ, but this PR should make IPython safe through libzmq-3.x.

@ellisonbg ellisonbg and 1 other commented on an outdated diff Sep 6, 2011
IPython/zmq/kernelmanager.py
@@ -187,8 +187,8 @@ class ShellSocketChannel(ZMQSocketChannel):
def run(self):
"""The thread's main activity. Call start() instead."""
- self.socket = self.context.socket(zmq.XREQ)
- self.socket.setsockopt(zmq.IDENTITY, self.session.session)
+ self.socket = self.context.socket(zmq.DEALER)
+ # self.socket.setsockopt(zmq.IDENTITY, self.session.session)
@ellisonbg
IPython member
ellisonbg added a line comment Sep 6, 2011

Why are these lines commented out? Should we not be setting IDENTITY?

@minrk
IPython member
minrk added a line comment Sep 6, 2011

Possible oversight (though session.session is unicode, and not appropriate for IDENTITY)

@ellisonbg
IPython member
ellisonbg added a line comment Sep 6, 2011
@minrk
IPython member
minrk added a line comment Sep 6, 2011

I was remembering incorrectly. I commented out the IDENTITY lines to test with libzmq-4.0, which has removed IDENTITY altogether. Session.session is not unicode until PR #663 is merged, which makes the appropriate change to Session.bsession. I have rolled back these lines with an amended commit to prevent conflicts. This PR now does not touch those lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ellisonbg ellisonbg and 1 other commented on an outdated diff Sep 6, 2011
IPython/zmq/session.py
@@ -614,7 +614,17 @@ class Session(Configurable):
point.
"""
if copy:
- idx = msg_list.index(DELIM)
+ from IPython.config.application import Application
+ log = Application.instance().log
+ try:
+ idx = msg_list.index(DELIM)
+ except ValueError:
+ # time.sleep(1)
+
+ log.error('%s', msg_list)
+ log.error('%s, %s, %s', msg_list[0], DELIM, msg_list[0] == DELIM)
+ raise
+ # print msg_list.index(DELIM)
@ellisonbg
IPython member
ellisonbg added a line comment Sep 6, 2011

Let's remove the commented lines (time.sleep and print msg_list...). Also, do we want Session to depend on Application?

@minrk
IPython member
minrk added a line comment Sep 6, 2011

Ah, now I get it. That whole thing is a debug block I was using, and should be removed (it has been). IPython.zmq.session is not changed at all now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@minrk minrk use ROUTER/DEALER socket names instead of XREP/XREQ
This is principally a big find/replace, but also
adjusts the import-check for pyzmq/zmq versions in IPython.zmq and IPython.parallel.

XREP/XREQ are aliases for ROUTER/DEALER in 0MQ 2.x.  These sockets continue to exist in 3.0 under the ROUTER/DEALER name only.  The XREP/XREQ protocols change some in 3.0, and won't work properly with current IPython.

It is likely that once 3.0 is stable (and pyzmq supports it better), we will want to move some sockets back to the *new* XREP/XREQ, but this PR should make IPython safe through libzmq-3.x.
7bde2f3
@minrk minrk merged commit 7bde2f3 into ipython:master Sep 6, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment