[zeromq-dev] Interrupted systen call

Diego Fons diego.fons at intraway.com
Wed Nov 26 22:28:01 CET 2014


AH, ok, I see... Going further in the code, I realize that EAGAIN is used
to notify timeouts (my mistake!).

What you said is true, any (uncaught) signal received by my application
will generate the described situation. Now, is there a known issue in which
the reception of a signal will lead in a bad ZMQ behavior? I'm asking that
because every time the exception is thrown, the ZMQ socket (DEALER in this
case) stops working, ie., if I send a new message after the exception, it
is not sent (extract of a trace):

#0  0x0000003ce7acad26 in poll () from /lib64/libc.so.6
#1  0x00002b8da3ba14f2 in zmq::signaler_t::wait (this=0x2b8da684a760,
timeout_=-1) at signaler.cpp:173
#2  0x00002b8da3b90850 in zmq::mailbox_t::recv (this=0x2b8da684a700,
cmd_=0x2aaaf1c1e5b0, timeout_=-1) at mailbox.cpp:72
#3  0x00002b8da3ba1e50 in zmq::socket_base_t::process_commands
(this=0x2b8da684a400, timeout_=-1, throttle_=<value optimized out>) at
socket_base.cpp:872
#4  0x00002b8da3ba2277 in zmq::socket_base_t::send (this=0x2b8da684a400,
msg_=0x2aaaf1c1ef80, flags_=<value optimized out>) at socket_base.cpp:724
#5  0x00002b8da3bb7a3a in s_sendmsg (s_=0x2b8da684a400,
msg_=0x2aaaf1c1ef80, flags_=0) at zmq.cpp:350
...

It seems the socket is waiting to receive something (see frame #2).

Could it be that the uncaught signal was generated in one of the ZMQ
internal pipes? Is there a good way of recovering from this situation?

Regards.

On Wed, Nov 26, 2014 at 5:08 PM, Alexey Komarov <alexey at komarov.org.ru>
wrote:

>  Hi,
>
> As I understand it's EINTR error. It can occur when your application gets
> a signal, i.e. SIGCHLD.
>
> Alexey
>
>
>
> On 11/26/2014 10:16 PM, Diego Fons wrote:
>
>  Hi,
>
>  I'm facing a weird situation, this mail is just to know if someone has
> already deal with this and, if so, how can I solve it.
>
>  I'm using the C++ wrapper (Linux) and I have this piece of code:
>
>  01 std::string error_descr;
> 02 bool sent = false;
> 03 try
> 04 {
> 05     // Build ZMQ frame to send message.
> 06     zmq::message_t frame;
> 07     frame.rebuild( message->size() );
> 08     memcpy( frame.data(), message->data(), message->size() );
> 09
> 10     // Send ZMQ frame.
> 11     sent = zmq_socket.send( frame );
> 12 }
> 13 catch( zmq::error_t& e )
> 14 {
> 15     // An interruption (signal?) prevented the message being sent.
> 16     sent = false;
> 17     error_descr = e.what();
> 18 }
> 19
> 20 if( not sent )
> 21 {
> 22     std::cout << "Message could not be sent: " << error_descr;
> 23 }
>
>  Line 11 is throwing and exception because the message in line 22 is
> shown:
>
>  Message could not be sent: Interrupted system call
>
>  I'm confused since the send method in zmq::socket_t prevent the
> exception throwing by asking if the return code is EAGAIN. Anyway, I serach
> the code and the message "Interrupted system call" is not part of the
> linux build.
>
>
>  ​Is it possible?​ What am I missing?
>
>  Regards.
>
>  --
>  Diego Andrés Fons
> Intraway Corp.
> Solution Developer
>  AR Office: +54 (11) 6040 4000
> US Office: +1 (516) 620 3890
> Email: diego.fons at intraway.com
>
>  Visit our website at http://www.intraway.com
> Proud to be an ISO 9001:2008 certified company
>
>
> _______________________________________________
> zeromq-dev mailing listzeromq-dev at lists.zeromq.orghttp://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>


-- 
Diego Andrés Fons
Intraway Corp.
Solution Developer
AR Office: +54 (11) 6040 4000
US Office: +1 (516) 620 3890
Email: diego.fons at intraway.com

Visit our website at http://www.intraway.com
Proud to be an ISO 9001:2008 certified company
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20141126/dfbb574d/attachment.htm>


More information about the zeromq-dev mailing list