[zeromq-dev] [REP-REQ] Sockets timeouts and connection reset

DUMAS, Victor Victor.DUMAS at stago.com
Thu Apr 12 14:51:28 CEST 2018


Thanks for you reply.
I need to reset the sockets periodically because setting no timeouts on them ends up in a REQ/REP deadlock where:

  *   PeerA sends a message
  *   PeerB receives it and sends a  ACK message
  *   PeerA never receives the ACK
  *   PeerB is waiting for the next message to arrive because the (REP) reply is not blocking

>From what I can see with wireshark the following sequence happens in a loop:

  *   [SYN], PeerB -> PeerA
  *   [RST,ACK], PeerA -> PeerB
  *   [TCP Retransmission], PeerB -> PeerA
  *   [RST,ACK], PeerA -> PeerB
  *   [TCP Retransmission], PeerB -> PeerA
  *   [RST,ACK], PeerA -> PeerB


De : Francesco<mailto:francesco.montorsi at gmail.com>
Envoyé le :Saturday, April 7, 2018 11:06 AM
À : ZeroMQ development list<mailto:zeromq-dev at lists.zeromq.org>
Objet :Re: [zeromq-dev] [REP-REQ] Sockets timeouts and connection reset

Hi Victor,

2018-04-06 17:44 GMT+02:00 DUMAS, Victor <Victor.DUMAS at stago.com<mailto:Victor.DUMAS at stago.com>>:
In order to not block forever each socket has sending and receiving timeouts. In case those timeouts are reached the sockets are destroyed and recreated.

this statement has triggered my attention: why would you do that ?
ZMQ sockets are meant to be long-lived objects from my understanding and if something bad happens at networking level (somebody pulls off the cable) they will automatically reconnect using ZMQ background threads once network connectivity is restored... I think that in your scenario destroying the sockets and recreating them is not really needed and does not really help: just keep retrying or (if you're using TCP transport and you have timeouts big enough) you can simply provide an error message of some kind (e.g. network failure)...

Just my 2 cents,

Click here<https://www.mailcontrol.com/sr/MZbqvYs5QwJvpeaetUwhCQ==> to report this email as spam.

This message has been scanned for malware by Websense. www.websense.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20180412/33cee6c0/attachment.htm>

More information about the zeromq-dev mailing list