[zeromq-dev] SUB and PUB sockets on one url over epgm/pgm

Sergey Zinov s.zinov at emw.hs-anhalt.de
Mon May 11 16:35:01 CEST 2015

Hi Arnaud,

Thanks for the answer. I know that I always should set subscriber option 
on sub socket, and I always do that(see my sample code). Problem is that 
it seems that strange behavior appears, depending on at which place I do 
this subscription. And I don't think that subscription option itself is 
the source of problem, I guess it incidentally fixes the problem when 
put at the right place.

Best regards

On 11.05.2015 16:04, Arnaud Loonstra wrote:
> On 2015-05-11 15:53, Sergey Zinov wrote:
>> Hi all,
>> I encountered problem, while using zeromq with epgm transport.
>> I have several nodes that should broadcast messages to each other,
>> for that purpose each node creates two sockets(one PUB and one SUB)
>> with same url. See attachment for sample code(python).
>> First I tested it on amd64 linux server, and it worked as I expected.
>> Each nodes can send and receive messages.
>> But then I tried it on ARM board, and it worked only
>> occasionally(something like 1 of 10 runs). I also tried to run it on
>> virtual machines, and sometimes observe such misbehavior there(but it
>> works most of the time). So it seems there is some connection between
>> performance of machine and this bug.
>> After some days of tries, I found out, that if I do
>> 'setsockopt(zmq.SUBSCRIBE, "")' for subscriber socket before I bind
>> publisher socket, it works, otherwise described behavior is observed.
>> With this 'fix' it seems to be working fine. But definitely something
>> is wrong here, and I'm not sure how robust this solution is. I'm not
>> really sure if it is a bug in zeromq at all - maybe I'm trying to use
>> zmq wrong way. Can anybody tell if there is better solution for my
>> case?
>> Best regards,
>> Sergey
> I'm not sure but I thought you always must set a subscribe option to a
> pub/sub socket.
> Also note this:
>   From ZeroMQ v3.x, filtering happens at the publisher side when using a
> connected protocol (tcp:// or ipc://). Using the epgm:// protocol,
> filtering happens at the subscriber side. In ZeroMQ v2.x, all filtering
> happened at the subscriber side.
> Rg,
> Arnaud
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

More information about the zeromq-dev mailing list