[zeromq-dev] Polling issue. Socket blocking on SendMessage

Tobias Elbert tobias_elbert at hotmail.com
Wed Aug 3 18:44:56 CEST 2016


Actually I think I just answered my own question:


In my case the socket is connected on a virtual VPN adapter and the VPN is still a bit flaky. We're still in the process of setting that up properly and I think what happened was that the VPN server machine went into hibernation so the sending socket's endpoint was no longer available. From memory this lines up time-wise with the other incidents I have mentioned (VPN going down and the socket blocking).


I suppose default behaviour also for Dealer sockets is to block and wait until the endpoint becomes available again rather than enqueue on its internal message queue?


Thanks

Tobias


________________________________
From: zeromq-dev <zeromq-dev-bounces at lists.zeromq.org> on behalf of Tobias Elbert <tobias_elbert at hotmail.com>
Sent: Wednesday, August 3, 2016 5:18 PM
To: zeromq-dev at lists.zeromq.org
Subject: [zeromq-dev] Polling issue. Socket blocking on SendMessage


Hi all,

I am having an issue with a setup similar to the sample in the Pastebin link provided below. Basically I let the poller block for 2 seconds and every 6 seconds send out a heartbeat from within the polling loop. My understanding is that while I'm in the polling loop that it is safe to do sends/ receives on any of the sockets on the poller.

This works fine for a few hours but after 2-3 hours (sometimes can also go for a whole day without issues). I put a fully functioning sample on Pastebin:

http://pastebin.com/diN8ymmD
[http://pastebin.com/i/facebook.png]<http://pastebin.com/diN8ymmD>

[C#] C# Bindings. Polling issue. Socket blocking on SendMessage - Pastebin.com<http://pastebin.com/diN8ymmD>
pastebin.com



For clarity, here the piece of code where the SendMessage call blocks indefinitely:

while(true)
{
    poller.Poll(TimeSpan.FromSeconds(2));

    if ((DateTime.UtcNow - lastHeartbeat).TotalSeconds > 5)
    {
        ZmqMessage hbMessage = new ZmqMessage();

        hbMessage.Append(Encoding.ASCII.GetBytes(HeartBeatMsg));

        Console.WriteLine("About to send Heartbeat {0}", DateTime.Now);
        // blocks here after a while:
        frontend.SendMessage(hbMessage); // blocks here

        Console.WriteLine("Sent Heartbeat {0}", DateTime.Now);

        lastHeartbeat = DateTime.UtcNow;
    }
}

Note I am using v3.2.5 libzmq and its corresponding C# bindings.


Any input would be appreciated.

Thanks Tobias.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20160803/7e142c96/attachment.htm>


More information about the zeromq-dev mailing list