[zeromq-dev] Polling issue. Socket blocking on SendMessage
Tobias Elbert
tobias_elbert at hotmail.com
Wed Aug 3 17:18:45 CEST 2016
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
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/815fe9c0/attachment.htm>
More information about the zeromq-dev
mailing list