-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZMQ_REQ_RELAXED does not work #1690
Comments
FredTreg
added a commit
to FredTreg/libzmq
that referenced
this issue
Jan 1, 2016
When using ZMQ_REQ_RELAXED and a 'send' is executed after another 'send' the previous code would terminate the 'reply_pipe' if any. This is incorrect as terminating the reply pipe also terminates the send pipe as they are the same (a pipe associated with a socket is bidirectional). Doing a terminate on the pipe sets an internal flag called out_active to false and the pipe can no longer send messages. Removing the 'terminate' solves the problem. Removing this call is not an issue as the incorrect ordering of messages that could be incurred is taken care of by the ZMQ_REQ_CORRELATE option if needed.
FredTreg
added a commit
to FredTreg/libzmq
that referenced
this issue
Jan 3, 2016
Current ZMQ_REQ_RELAXED test improvement to check that pipes are not closed after executing two send() in a row with no recv() in between.
This was referenced Mar 20, 2016
fredoboulo
added a commit
to fredoboulo/jeromq
that referenced
this issue
Sep 18, 2017
present in libzmq/4.1
This was referenced Sep 18, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The ZMQ_REQ_RELAXED option should allow you to send two messages in a row without a successful receive in between.
This does not seem to work as the simple example below (two "send" in a row) blocks indefinitely.
Note: this does not work even if the server is connected and responding.
Am I mistaken somehow?
I could track down the issue to this piece of code in req.cpp :
Indeed, terminating the reply pipe also terminates the send pipe as they are the same (the pipe associated with the socket is bidirectional). Doing a terminate on the pipe sets an internal flag called
out_active
tofalse
and the pipe can no longer send messages.A simple removal of the
terminate
line solves the problem. Removing this line should not be an issue as the incorrect ordering of messages that could be incurred is taken care of by the ZMQ_REQ_CORRELATE option if needed.Example code demonstrating the issue (without error handling to make it clearer):
The text was updated successfully, but these errors were encountered: