[zeromq-dev] labels and the behavior of XREQ/XREP

MinRK benjaminrk at gmail.com
Fri Sep 16 20:44:27 CEST 2011

On Fri, Sep 16, 2011 at 09:39, Chuck Remes <cremes.devlist at mac.com> wrote:

> While adding support for the 3.0 API changes to the Ruby FFI bindings, I
> came across some behavior that I don't understand.
> I read through the thread from earlier this month (title "XREP/ROUTER no
> longer receive messages atomically     in 3.0/4.0") where some of this
> behavior was discussed.
> To recap, the wire protocol now has a field for tagging a message part as a
> "label." A label is used with XREQ/XREP/ROUTER/DEALER socket types for
> storing the routing envelope details. In 2.x this data was just a regular
> message part but it was separated from user content by a null message part.
> When reading a label part, checking the socket for RCVMORE returns false
> even if there are more parts (label or otherwise) to be read.
> The thread appeared to have consensus that this behavior was incorrect and
> surprising. Instead, each label part should also return true for RCVMORE.
> In my testing, I see that the original behavior still exists. Checking for
> RCVMORE on a label part returns false.
> To make matters more confusing, the IDENTITY support is different. My
> understanding was that 3.0 would continue to support custom user-set
> identities just like 2.1.x, but my test results show that is not true.

I believe ROUTER/DEALER sockets are unchanged from 2.1.x, and do not use the
LABEL prefix.  XREP/XREQ is no longer an alias for ROUTER/DEALER in 3.0.  As
a test case, IPython.parallel, which uses the ROUTER/DEALER pattern
extensively, works just fine with libzmq-3.0 and 2.1.x without any changes.


> I ran 4 tests with every combination of REQ, REP, XREQ and XREP socket
> types all with custom set IDENTITY. In no case did my custom IDENTITY make
> it through to the other side intact.
> https://gist.github.com/1222475
> Furthermore, the sending of label parts looked inconsistent to me.
> When sending data between a REQ and REP socket, labels aren't exposed (as
> expected) and my user content was delivered correctly.
> When sending data between a REQ and XREP socket, the XREP socket received 2
> label parts (and RCVMORE was false on both) and my user content as the 3rd
> part. The label parts were gibberish and neither represented the custom
> IDENTITY that was set earlier.
> When sending data between a XREQ and XREP socket, the XREP socket received
> *1* label part and my user content as the 2nd part. This is different from
> the case above (REQ to XREP) by missing one of the label parts. It worked
> but perhaps it should not have worked? Also, the label part had gibberish in
> it instead of the custom IDENTITY.
> I'm quite confused over how the 3.0 API is supposed to work with labels and
> whether or not IDENTITY values are supposed to be preserved between peers.
> Can anyone shed some light on this?
> cr
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110916/c54cb06f/attachment.htm>

More information about the zeromq-dev mailing list