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

Francesco francesco.montorsi at gmail.com
Sat Apr 14 11:48:42 CEST 2018


Hi Victor,
did you look at ZMQ_REQ_RELAXED option?

With that I think you should manage to use REQ/REP without having to
destroy sockets and recreate them...

HTH,
Francesco



2018-04-12 14:51 GMT+02:00 DUMAS, Victor <Victor.DUMAS at stago.com>:

> Francesco,
>
>
>
> 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
>
>
>
> Victor
>
>
>
> *De : *Francesco <francesco.montorsi at gmail.com>
> *Envoyé le :*Saturday, April 7, 2018 11:06 AM
> *À : *ZeroMQ development list <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>:
>
>> 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,
> Francesco
>
>
>
>
>
> 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
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20180414/d0b5b0b2/attachment.htm>


More information about the zeromq-dev mailing list