Reason for zmq error code 156384763

China☆狼群 提交于 2019-12-23 10:56:44

问题


I am using zmq req/rep pattern communication. The implementation is pretty simple, the req sends some data and waits on recv. The rep receives the data, process and reply back.

//REQ
zmq_connect
zmq_send
zmq_recv //blocking
zmq_close

//REP
zmq_bind
while(true) {
  while(data_received) {
    //miscellaneous process
    zmq_recv //non-blocking
      Print zmq_error_no if zmq_recv fails
  }
  zmq_send
}

In the REP side, during zmq_recv timeout zmq_error_no 11 will be printed. But sometimes i am getting error no 156384763. could anyone tell the meaning for that error?


回答1:


This is the native ZeroMQ error EFSM:

The zmq_send() operation cannot be performed on this socket at the moment due to the socket not being in the appropriate state. This error may occur with socket types that switch between several states, such as ZMQ_REP.

Sources: zmq_send, zmq.h




回答2:


Here another victim of this EFSM error, which turns up when receiving from a REP socket.

For me the direct reason was not answering some of the requests made by the client. Remember that the messaging pattern strictly requires you to send a reply! If you don't then the server becomes confused and simply stops working.

So, how can this happen in practice?

Well, you could find yourself porting a legacy protocol to ZeroMQ (like me). Where the original author simply didn't bother to reply to some request(s). So as soon as you hit a request like that, the server breaks.

Or imagine an exception occurs in your code while handling that particular problematic request. We can then inadvertently skip our send-the-reply-message code!



来源:https://stackoverflow.com/questions/28989226/reason-for-zmq-error-code-156384763

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!