[zeromq-dev] Pipeline Reliability

Charles Bouillaguet charles.bouillaguet at gmail.com
Thu Jul 5 18:08:44 CEST 2018

On Tue, Jul 03, 2018 at 04:25:32PM +0100, Luca Boccassi wrote:
> On Tue, 2018-07-03 at 16:08 +0200, Charles Bouillaguet wrote:
> > I'm facing a reliability problem that I couldn't solve by myself so
> > far.
> > ...

> 1) Don't close/reopen the socket, you can avoid blocking with DONTWAIT
> by itself
> 2) Enable the heartbeat options for faster automated disconnects and
> reconnects

I tried the approach you suggested, to no avail (but I may have done it wrong).

Long story short : the "client" connects a PUSH socket and the "server" binds a
PULL socket. The client then pushes messages.

When everything gets stuck, I observed that restarting either the server or the
client re-establishes the flow. I tried to do this on the client (only):

       socket = zmq_socket(zmq_ctx, ZMQ_PUSH);
       int heartbeat_interval = 1000; // milliseconds
       int heartbeat_timeout = 5000; // milliseconds
       zmq_setsockopt(socket, ZMQ_HEARTBEAT_IVL, &heartbeat_interval, sizeof(heartbeat_interval));
       zmq_setsockopt(socket, ZMQ_HEARTBEAT_TIMEOUT, &heartbeat_timeout, sizeof(heartbeat_timeout));
       zmq_connect(socket, address);

and then:

       zmq_send(socket, &msg, sizeof(msg), ZMQ_DONTWAIT);

But alas! The server still stops receiving messages at some point. Should I also
setup Heartbeating on the server?

Université de Lille - Sciences et Technologies
charles.bouillaguet at univ-lille1.fr | www.univ-lille1.fr
Laboratoire CRIStAL - Bât M3 - Bureau 332 - 59655 Villeneuve d'Ascq
Tél. +33 (0)3 28 77 85 84
homepage:  http://cristal.univ-lille.fr/~bouillag/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20180705/965662af/attachment.sig>

More information about the zeromq-dev mailing list