Hi, we're looking to upgrade ZMQ to 4.0.5, and are looking for a quality binding. CastleZMQ's binding looks the best, but we have concerns that some of the tests are failing and that some get stuck in an infinite loop.
Steps:
Problems:
- All the RemoteRequestServiceTestCase.cs tests fail, due to StubSocket not being castable to Socket
- Tests "when_recvTimeout_recv_should_return_null", "creating_pub" and "creating_sub_and_subscribing_to_specific_weird_topic" all loop forever
-------------------------------------------------------------------------------------------------------------------------------------------------------------
The culprit appears to be in
https://github.com/castleproject/castlezmq/blob/master/src/Castle.Zmq/Socket.cs (
The issue is in red):
public byte[] Recv(bool noWait = false) // noWait is set to false
{
EnsureNotDisposed();
using (var frame = new MsgFrame())
{
var flags = noWait ? Native.Socket.DONTWAIT : 0;
again: // We loop here forever
var res = Native.MsgFrame.zmq_msg_recv(frame._msgPtr, this.SocketPtr, flags);
if (res == Native.ErrorCode) // res always equals Native.ErrorCode (-1) for the "looping" tests
{
var error = Native.LastError();
if (error == ZmqErrorCode.EAGAIN || error == ZmqErrorCode.EINTR) goto again; // It's always EAGAIN (11)
if (LogAdapter.LogEnabled)
{
LogAdapter.LogError("Socket", "Recv interrupted with " + error + " - " + Native.LastErrorString(error));
}
Native.ThrowZmqError(error, "Recv");
}
else
{
return frame.ToBytes();
}
}
return null;
}
Apart from the fact that these tests are failing, we're concerned that if you've set ZMQ noWait to be false, shouldn't *zmq_msg_recv* be blocking, rather than returning an instruction that you should block? Or is this something we don't understand about ZMQ's behaviour?
This definitely looks like the best binding available for us, and I'm guessing you've solved these issues internally?
Thanks for any help!