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

2016-08-06 Thread Tobias Elbert
Thanks for the pointer to the spec. The send high-water-mark was set to 0 which 
- if i am not mistaken - should disable the limit altogether. According to the 
spec, however, it blocks when either criterion is met.





From: zeromq-dev <zeromq-dev-boun...@lists.zeromq.org> on behalf of alex. 
<thissid...@riseup.net>
Sent: Thursday, August 4, 2016 9:51 AM
To: ZeroMQ development list
Subject: Re: [zeromq-dev] Polling issue. Socket blocking on SendMessage

Yes. In ZMQ the send operation is blocking until the message could be
queued to the socket[1]. Not however that the socket in question is the
sending socket not the receiving one. The sending Dealer-Socket is
itself supposed to block once its High-Water-Mark has been reached due
to no receiving sockets being available[2].

You can however add the ZMQ_NOBLOCK flag to the send operation that does
not block but sets the errno integer to EAGAIN (afaik you can also check
the returned integer of zmq_send())[1]. In that case the Dealer-Socket
would still reach its HWM but the send operation would not block.
However that's probably not what you want ;). Still wanted to share that
detail.

Best,
alex.


[1]: http://api.zeromq.org/2-1:zmq-send
zmq_send (3) - 0MQ Api<http://api.zeromq.org/2-1:zmq-send>
api.zeromq.org
Description. The zmq_send() function shall queue the message referenced by the 
msg argument to be sent to the socket referenced by the socket argument.



[2]: http://api.zeromq.org/2-1:zmq-socket#toc6

On 03.08.2016 18:44, Tobias Elbert wrote:
> 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-boun...@lists.zeromq.org> on behalf of
> Tobias Elbert <tobias_elb...@hotmail.com>
> *Sent:* Wednesday, August 3, 2016 5:18 PM
> *To:* zeromq-dev@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/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.
>
>
>
>
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

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

2016-08-04 Thread alex.
Yes. In ZMQ the send operation is blocking until the message could be
queued to the socket[1]. Not however that the socket in question is the
sending socket not the receiving one. The sending Dealer-Socket is
itself supposed to block once its High-Water-Mark has been reached due
to no receiving sockets being available[2].

You can however add the ZMQ_NOBLOCK flag to the send operation that does
not block but sets the errno integer to EAGAIN (afaik you can also check
the returned integer of zmq_send())[1]. In that case the Dealer-Socket
would still reach its HWM but the send operation would not block.
However that's probably not what you want ;). Still wanted to share that
detail.

Best,
alex.


[1]: http://api.zeromq.org/2-1:zmq-send
[2]: http://api.zeromq.org/2-1:zmq-socket#toc6

On 03.08.2016 18:44, Tobias Elbert wrote:
> 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-boun...@lists.zeromq.org> on behalf of
> Tobias Elbert <tobias_elb...@hotmail.com>
> *Sent:* Wednesday, August 3, 2016 5:18 PM
> *To:* zeromq-dev@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/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.
> 
> 
> 
> 
> ___
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

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

2016-08-03 Thread Tobias Elbert
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-boun...@lists.zeromq.org> on behalf of Tobias 
Elbert <tobias_elb...@hotmail.com>
Sent: Wednesday, August 3, 2016 5:18 PM
To: zeromq-dev@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.


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

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

2016-08-03 Thread Tobias Elbert

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.


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev