[zeromq-dev] lost message due to EINTR

sven.koebnick at t-online.de sven.koebnick at t-online.de
Fri Jan 9 08:30:28 CET 2015


Hi * ! 

I recently switched from ZMQ2 (pretty old) to ZMQ 4 and
since then have some problems in debugging with EINTR. 

Following code:

 do {
 rc = zmsg_send (&zrep, clsocket_);
 if (rc<0) {
 if (errno ==
EINTR || errno == EAGAIN) {
 logWarn("temporary failure in zmq send()
... will be tried again.");
 } else {
 logFatal("hard error in sending
zmq ... manually destroying message ... it will be lost");

 if (zrep) {
 logWarn("sending of reply msg
returned rc("<<rc<<"), zmq_errno("<<zmq_errno()<<")
 logWarn("but message is still existent
... retrying");
 } else {
 logError("sending of reply msg returned
rc("<<rc<<"), zmq_errno("<<zmq_errno()<<")
 logFatal("message nulled anyway by zmq
... seems lost ...");
 } while (zrep); // repeat until message is

This snippet usualy works, but sometimes I get the warning of
EINTR. No problem, I thought, but despite returning an error (rc==-1,
errno==EINTR) the message pointer is NULLed, so I cannot resend the

The Logs prove, that indeed the message is NOT sent, and for
resending I'd need a copy ... what am I doing wrong? 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150109/b53c16f2/attachment.htm>

More information about the zeromq-dev mailing list