[zeromq-dev] recv in REQ client blocks forever if XREP server dies

Troy Gutjahr zmq-devlist at troy.cygnusconnect.com
Sun Dec 5 10:37:10 CET 2010


OK, I tried to do this. Now when my REP client gets a timeout from
zmq::poll when waiting for a response from the dead XREP server process,
it tries to send another message to the same socket, which has a
restarted XREP server process bound to the other end. The send function
fails with errno = EFSM. What should the client do to reset the socket
into a functional state?

-- Troy

On Sun, 05 Dec 2010 08:51 +0100, "Martin Sustrik" <sustrik at 250bpm.com>
wrote:
> Troy,
> 
> > recv is not expected to fail if the server that has bound to the
> > endpoint dies? The only way to for the client to detect that situation
> > is by using poll with a timeout? This is not the behaviour that I would
> > have expected and so I spent the last two days reading the
> > documentation, experimenting and endlessly searching the devlist
> > archives trying to find out what I was doing wrong. :-)
> 
> Feel free to submit a documentation patch. Maybe mentioning the 
> reconnect semantics in zmq_connect(3)?
> 
> > I think you are saying that I would have to write my client code like
> > this:
> >
> > send the request to the XREP server
> > poll the REP socket with a timeout
> > if event from REP socket
> >     recv the response from the server
> > else if timeout
> >     handle the failure of the request and get ready to send another
> >     request
> >
> > Is that right?
> 
> Yes.
> 
> Martin
> 



More information about the zeromq-dev mailing list