-
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
Problem: In zmq::socket_base_t::send method with or without ZMQ_ROUTER_MANDATORY option set #2348
Comments
@reza-ebrahimi I don't think there is a bug, or at least not the one you describe. In case of EHOSTUNREACH the method will exit without going to the while loop. Only when EAGAIN is returned this while loop will be reached. However there is an issue here, if the peer is not active but do exist the method will block. Two options here, first just specify DONT_WAIT flag, it will never block. You can find the commit here: Do you want to port the fix and make a pull request? |
@somdoron Yes, only with EAGAIN will reach to while loop and blocks. I don't understand it, why that could be an EAGAIN error, while DEALER process completely terminated? what does that means? About DONT_WAIT option, I think that is suitable for recv method not send, a blocking send could cause problems in application specific logic, I think select is in main thread that zeromq created on and it was wrong, those mechanism should move to IO thread or another appropriate thread, and communicate with socket object via signalers, this mechanism have some troubles. I'll review your mentioned commit. |
DONT_WAIT works on sending as well. Regarding dealer being terminate, it can take some time for the dealer to be entirely deleted from the list of pipes, that is why it is blocking. To fix you can just use DONT_WAIT or port the fix |
I bumped into this behavior a few days ago too: https://lists.zeromq.org/pipermail/zeromq-dev/2017-February/031413.html |
Yes please, if you can send a PR it would be great |
This is the send method in
socket_base_t
class, and there is a bug here, in the case ofROUTER
socket, we have two processes, one isROUTER
process and another isDEALER
process, code below is theROUTER
process:and there problem is in below send method, due to
ZMQ_ROUTER_MANDATORY
option, it might returnEHOSTUNREACH
or-1
, but it goes to last while loop to process remained commands and blocks inselect
system call untill anotherDEALER
process coming up!if
ZMQ_ROUTER_MANDATORY
option is set, it should return before reach to last while loop, is still processing command for a disconnected socket necessary? or ifZMQ_ROUTER_MANDATORY
option is set?blocking in send method is unacceptable by any reason, in this scenario it should return actual error code with its string to the caller.
The text was updated successfully, but these errors were encountered: