[zeromq-dev] Unsuccessful send/receive on Router following reconnect

Wilson Chong wiz.redsuns at gmail.com
Tue Nov 8 21:26:52 CET 2016


Thanks Max! I haven't thought of that option! Thank you!

On Wed, Nov 9, 2016 at 4:16 AM, Max Kozlovsky <max at portworx.com> wrote:

> Hi,
>
> Make sure you have ZMQ_ROUTER_HANDOVER option set on the sockets if you
> want to reuse the identity across process restarts.
>
> Max
>
> On Tue, Nov 8, 2016 at 12:01 PM, Wilson Chong <wiz.redsuns at gmail.com>
> wrote:
>
>>
>> my answer is actually based on my own experience. if i tried using
>> "durable" socket by assigning an identity manually to the socket, it won't
>> reconnect once it disconnects.
>>
>> i've read somewhere before that there's plan to phase out the "durable"
>> socket, but i wasn't able to follow it, not sure what really happen.
>>
>>
>> On Wed, Nov 9, 2016 at 2:28 AM, Aaron Friesen <AFriesen at spirae.com>
>> wrote:
>>
>>> Wilson,
>>>
>>>
>>>
>>> Can you explain how removing that line would help?
>>>
>>>
>>>
>>> For Router-to-Router, one or both ends has to have a known identity.  In
>>> my case, since each peer has a known GUID associated with it, that becomes
>>> its Identity, specifically, the line you are telling me to remove.
>>>
>>>
>>>
>>> Plus, everything works when all processes are started the first time,
>>> even late joiners.  The problem only occurs when one of them has to restart.
>>>
>>>
>>>
>>> Aaron
>>>
>>>
>>>
>>> *From:* zeromq-dev [mailto:zeromq-dev-bounces at lists.zeromq.org] *On
>>> Behalf Of *Wilson Chong
>>> *Sent:* Tuesday, November 08, 2016 10:41 AM
>>> *To:* ZeroMQ development list <zeromq-dev at lists.zeromq.org>
>>> *Subject:* Re: [zeromq-dev] Unsuccessful send/receive on Router
>>> following reconnect
>>>
>>>
>>>
>>>
>>>
>>> try remove the line _requestSocket.Identity = Encoding
>>> .UTF8.GetBytes(_selfID);
>>>
>>>
>>>
>>> On Wed, Nov 9, 2016 at 1:07 AM, Aaron Friesen <AFriesen at spirae.com>
>>> wrote:
>>>
>>> Thanks in advance for assistance.
>>>
>>>
>>>
>>> Using ZeroMQ C# bindings (4.1.0.21) with libzmq (4.1.5.0) on Windows (7,
>>> Server 2008 R2, and Server 2012).
>>>
>>>
>>>
>>> For request/response functionality I am using a single Router socket
>>> (tcp) in each of several interconnected processes.
>>>
>>>
>>>
>>> Each process has an identifier (GUID) that is known by all other
>>> processes, which is used as the Identity on the socket.
>>>
>>>
>>>
>>> Each process performs a Bind on a specific port (also known by all other
>>> processes), and also performs a Connect to each of the other Router sockets
>>> in the other processes.
>>>
>>>
>>>
>>> For example, if 5 processes are used, visualize a completely
>>> interconnected star.
>>>
>>>
>>>
>>> When all 5 processes are initially started, communication works great.
>>> I can send and receive messages between any of the 5.
>>>
>>>
>>>
>>> The problem comes if for some reason I must restart one of the 5.  Once
>>> that process is restarted, communication with the other 4 seems to go
>>> nowhere, for both incoming and outgoing traffic.
>>>
>>>
>>>
>>> I have monitors on all of the sockets which seems to show that
>>> everything is reconnecting.
>>>
>>>
>>>
>>> I also have RouterMandatory set to Report.  Sends from the newly
>>> restarted process do not Report when attempting to Send to the other
>>> processes, and the other processes do not Report when attempting to Send to
>>> the restarted process.
>>>
>>>
>>>
>>> If I stop one of the other remaining processes, then attempts to Send to
>>> that process Report as expected.
>>>
>>>
>>>
>>> I also have pub/sub socket connections, with each process publishing a
>>> heartbeat, and those sockets all successfully reconnect.
>>>
>>>
>>>
>>> I am testing all of this from (in this example) a 6th process that
>>> simply connects to the other 5 processes (also using a Router socket, no
>>> Bind involved), and it successfully reconnects to the restarted process
>>> without any problems and can send messages (and receive subsequent
>>> response) with any of the other 5, including any processes that are
>>> restarted.  This 6th process does not publish to the other 5, but does
>>> subscribe to the heartbeats.  I am convinced that the fact that 6th
>>> process successfully reconnects is a clue to what I am doing wrong, but it
>>> has been insufficient for me to find out what the root problem really is.
>>>
>>>
>>>
>>> The only other thing to note is that Linger is set to zero prior to
>>> Bind/Connect.
>>>
>>>
>>>
>>> The code for all processes for setting up the Router socket is:
>>>
>>>
>>>
>>>             using (_requestSocket = new ZSocket(_context, ZSocketType
>>> .ROUTER))
>>>
>>>             {
>>>
>>>                 try
>>>
>>>                 {
>>>
>>>                     _requestSocket.Monitor(Endpoint_RequestMonitor, out
>>> error);
>>>
>>>                     Debug.Assert(error == ZError.None);
>>>
>>>
>>>
>>>                     _requestSocket.Identity = Encoding
>>> .UTF8.GetBytes(_selfID);
>>>
>>>                     _requestSocket.Linger = TimeSpan.Zero;
>>>
>>>                     _requestSocket.RouterMandatory = RouterMandatory
>>> .Report;
>>>
>>>
>>>
>>>                     _requestSocket.Bind(Endpoint_RequestInproc, out
>>> error);
>>>
>>>                     Debug.Assert(error == ZError.None);
>>>
>>>
>>>
>>>                     endpoint = string.Format("tcp://*:{0}",
>>> _requestPort);
>>>
>>>                     _requestSocket.Bind(endpoint, out error);
>>>
>>>                     Debug.Assert(error == ZError.None);
>>>
>>>                 }
>>>
>>>                 catch (Exception ex)
>>>
>>>                 {
>>>
>>>                     Environment.Exit(-1);
>>>
>>>                 }
>>>
>>>
>>>
>>> Thanks for any assistance or advice you can provide,
>>>
>>>
>>>
>>> Aaron
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>
>>>
>>>
>>> _______________________________________________
>>> zeromq-dev mailing list
>>> zeromq-dev at lists.zeromq.org
>>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>>
>>
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161109/cdd9c6f4/attachment.htm>


More information about the zeromq-dev mailing list