zeromq / netmq

A 100% native C# implementation of ZeroMQ for .NET
Other
2.95k stars 744 forks source link

Add support for ZMQ_REQ_CORRELATE and ZMQ_REQ_RELAXED #866

Closed dhyams closed 4 years ago

dhyams commented 4 years ago

Environment

NetMQ Version:    4.0.0.207
Operating System: Windows 10
.NET Version:     Core 3.1

Expected behaviour

Expected that NetMQ has support for ZMQ_REQ_CORRELATE and ZMQ_REQ_RELAXED.

in accordance with

http://api.zeromq.org/4-1:zmq-setsockopt

Actual behaviour

NetMQ does not support either of these flags, which are important for being able to perform request/reply in a failsafe way.

dhyams commented 4 years ago

I took a good stab at this last night, but I need some advice/support for how the zmq c code works in req.cpp; I don't understand how the recv_reply_pipe works or whether similar behavior in NetMQ is necessary, especially since this doesn't seem to be replicated in NetMQ. The code in question is here:

https://github.com/zeromq/libzmq/blob/e05fe370fe6a3d4432b948c853efbda83ddbd45e/src/req.cpp#L247

Here is my branch for this:

https://github.com/dhyams/netmq/tree/relaxed_correlate

Maybe @somdoron can help? This is related to issue https://github.com/zeromq/netmq/issues/817

Thank you! I think this is very close to being done, but there is one last item that I don't understand.

dhyams commented 4 years ago

It occurred to me a little later to describe the immediate problem better. Here is what is happening now that I'm trying to solve:

Execute test SimpleReqRepWithCorrelation. This test just sets up a REQ port and REP port, sends a request from REQ to REP, and then a reply from REP to REQ. It's during the receive of the reply on the REQ side, that the test hangs.

The reason that it hangs is that on line 149, (which is inside Req.XRecv), the call to base.XRecv returns false every time. image

somdoron commented 4 years ago

I have started to review it, will continue later, looks good so far.

dhyams commented 4 years ago

@somdoron Thank you for the speedy merges!

What is the normal release cadence to have this available on NuGet? I'm trying to decide if we should wait for a prerelease, or just use what is on master right now in our project.

somdoron commented 4 years ago

I released a pre-release with this. Should be on nuget in few minutes.

On Tue, May 5, 2020, 17:41 dhyams notifications@github.com wrote:

@somdoron https://github.com/somdoron Thank you for the speedy merges!

What is the normal release cadence to have this available on NuGet? I'm trying to decide if we should wait for a prerelease, or just use what is on master right now in our project.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zeromq/netmq/issues/866#issuecomment-624096257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUW75VWM3D7ODHKIJT27RDRQAQQ5ANCNFSM4MWZ6XOQ .

dhyams commented 4 years ago

Wow, thanks!

somdoron commented 4 years ago

https://www.nuget.org/packages/NetMQ/4.0.1.2-pre