Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reason for zmq error code 156384763

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?

like image 327
Kumar Avatar asked Mar 11 '15 14:03

Kumar


2 Answers

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

like image 178
metadings Avatar answered Nov 10 '22 08:11

metadings


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!

like image 2
E. van Putten Avatar answered Nov 10 '22 08:11

E. van Putten