[zeromq-dev] ZMQ router-dealer set-up: can old socket identities be recycled? ("inproc")

Pieter Hintjens ph at imatix.com
Mon Nov 12 14:53:57 CET 2012

Hi Kah-Chan,

Is it possible you're using 2^32 DEALER sockets?

See how router chooses an automatic peer ID, in
random.cpp:generate_random() and in bool zmq::router_t::identify_peer
(pipe_t *pipe_).

If you are hitting the 32-bit limit, then try raising it to 64 bits,
then send us a pull request if that works.

If you're reusing identities for some other reason, you need to
explain in more detail how you assign identities.


On Mon, Nov 12, 2012 at 10:24 PM, Kah-Chan Low <kahchanlow at yahoo.com> wrote:
> I am using the router(server)--dealer(client) set-up in C++.  In my
> application, an existing dealer(client) connection may be disconnected from
> the router any time and the socket deallocated.  Similarly new dealers may
> be created and connect to the router at any time.  Each dealer is contained
> inside an object and I cast the object pointer into a string and set that as
> the dealer's identity.  During the course of execution new objects are
> continually created and old objects deleted.  As a result, it is possible to
> get a new object with the same object pointer value as one that has been
> recently deleted.  From time to time I would discover that messages sent by
> a dealer of a newly allocated object were getting lost; and this invariably
> happened when the new object has the same pointer value as an object that
> had been recently deallocated.  I then switched to a naming scheme that
> avoided recycling old socket identity names and the problem went away!  So
> it looks like the router has memory of identities of disconnected socket.
> Is this intended.  My application is supposed to run for months and that
> means I have to use increasing long strings to ensure identity uniqueness.
> Won't this have an impact on performance?
> BTW, I am using "inproc" protocol.
> Thanks!
> KC
> _______________________________________________
> 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