[zeromq-dev] RFC: PPPP - Paranoid Pirate Publishing Protocol
Goswin von Brederlow
goswin-v-b at web.de
Wed Jul 2 14:08:48 CEST 2014
On Tue, Jul 01, 2014 at 06:23:41PM +0200, Pieter Hintjens wrote:
> On Tue, Jul 1, 2014 at 4:46 PM, Goswin von Brederlow <goswin-v-b at web.de> wrote:
>
> > 1) with ROUTER/DEALER I don't get a message when a subscriber
> > disconnects without unsubscribing.
> >
> > Eventualy the heartbeat will get it but that can take a long time and
> > a lot of messages can queue up inbetween for no good reason.
>
> There is no other way, in practice. Even if libzmq reports the TCP
> disconnect, there are cases where the network connection will block
> and die without reporting an error. You must eventually use
> heartbeats. You can tune these to a few seconds.
But with tcp there is a way. And (X)PUB/(X)SUB do use it. I know it
isn't totaly reliable since it can't catch kernel or network crashes
in a timely fashion. But 99.999% of cases will properly close the tcp
socket.
The goal is to catch the common case early while still handling the
exceptional one with heartbeats.
> > So I tried using a monitor socket. But that only gives me the FD and
> > address of the receiving socket:
>
> No use IMO.
>
> > 2) with XPUB/XSUB the CURVE metadata seems to get lost
> >
> > zmq_msg_gets() always returns Null it seems. I think the problem is
> > that zmq::xpub_t::xread_activated just appends the message data to its
> > internal std::deque. A ROUTER socket on the other hand attaches the
> > pipe to its fair queue.
> >
> > Should this be rewritten to use a fair queue too?
>
> That would make sense, yes.
>
> -Pieter
MfG
Goswin
More information about the zeromq-dev
mailing list