Dear Dhammika and Chuck,

I am trying to use an XREP socket as a PUB socket with publisher side
filtering. In our case we dont need multiple subscriptions from a single
sub-socket, so we are trying to use  XREQ sockets as sinks and XREP socket
as router as discussed in the guide - Advanced Stuff Chapter. Its working to
our expectations but zmq fails with assertion at line 60 in xrep.cpp
sometimes. I believe thats because of duplicate identitites.

<CODE>

//  TODO: What if new connection has same peer identity as the old one?
outpipe_t outpipe = {outpipe_, true};
bool ok = outpipes.insert (outpipes_t::value_type (
            peer_identity_, outpipe)).second;
zmq_assert (ok);   //-------------> *Failing here*

</CODE>

When going the recommended way of using PUB-SUB sockets, the computational
overhead for each message is very high. With just one subscription for each
SUB socket, every message is copied and sent to every SUB socket and
filtered there. Thats *m x n *complexity, where *m* is the number of
messages processed per second and *n* is the number of subscribing sockets.
Ideally the complexity should be just *m*.

Now coming to XREP behaviour. I believe dropping connections with duplicate
identities or throwing an error is not an option atleast in regard to our
use case. Atleast in our case honoring duplicates and routing messages to
all the sockets with an identity is the desired behavior.

More over there seems to be a bug with deleting identities stored inside
XREP when the concerned XREQ is closed.

To reproduce this bug in 2.0.10 stable release.


   1. Create XREP and bind to an "inproc://address"
   2. Create XREQ, set identity to "ABCD" and connect to XREP on
   "inproc://address"
   3. Send messages through XREP to XREQ socket.
   4. Close the XREQ with identity "ABCD"
   5. Create XREQ, set identity again to "ABCD" and connect to XREP on
   "inproc://address"
   6. Now XREP fails with assertion in line 60 of xrep.cpp

Thanks and Regards,

Praveen


On Thu, Dec 2, 2010 at 6:22 AM, Dhammika Pathirana <dhamm...@gmail.com>wrote:

> Hi Praveen,
>
> On Wed, Dec 1, 2010 at 2:19 PM, Praveen Baratam
> <praveen.baratam+...@gmail.com <praveen.baratam%2b...@gmail.com>> wrote:
> > Dear Chuck,
> > Thanks for the quick reply.
> > Well if ever an Identity is reused, I guess the earlier socket connected
> > with that identity will be orphaned and all the messages will be routed
> to
> > the new socket with that ID. Effectively the session held by the old
> socket
> > will be hijacked by the new one.
> > Is this the expected behavior?
>
>
> We've fixed this problem, connection requests with duplicate IDs are
> dropped.
>
>
> Dhammika
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to