[zeromq-dev] zmq_ctx_term hang
Michi Henning
michi at triodia.com
Tue Apr 1 15:07:16 CEST 2014
Here are the top few stack frames for the hang:
#0 0x00007fe7f0e34fbd in poll () at ../sysdeps/unix/syscall-template.S:81
#1 0x00007fe7f0048f8a in poll (__timeout=-1, __nfds=1, __fds=0x7fffbf37c0d0)
at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
#2 zmq::signaler_t::wait (this=this at entry=0xfd43c8, timeout_=timeout_ at entry=-1) at signaler.cpp:173
#3 0x00007fe7f0035807 in zmq::mailbox_t::recv (this=this at entry=0xfd4368, cmd_=cmd_ at entry=0x7fffbf37c130,
timeout_=timeout_ at entry=-1) at mailbox.cpp:72
#4 0x00007fe7f002b211 in zmq::ctx_t::terminate (this=this at entry=0xfd42d0) at ctx.cpp:134
#5 0x00007fe7f005d908 in zmq_ctx_term (ctx_=0xfd42d0) at zmq.cpp:171
#6 0x00007fe7f1de8361 in zmqpp::context::~context (this=0xfd2ca0, __in_chrg=<optimized out>)
at /usr/include/zmqpp/context.hpp:96
Michi.
On 1 Apr 2014, at 13:59 , Michi Henning <michi at triodia.com> wrote:
> Hi,
>
> I'm looking for some advice on how to debug a hang in zmq_ctx_term().
>
> Basically, I have a number of sockets in use in my program. They all set the linger timeout to zero (or a small wait time, on the order of 300 ms).
>
> When I finally shutdown (via the zmqpp::context destructor), I end up hanging in zmq_ctx_term(). This doesn't happen deterministically—I get the hang once in about twenty tries or so. When the hang occurs, all my threads have terminated, and the only threads remaining are the main thread, plus two internal threads created by zmq.
>
> I know that terminating requires all sockets to be closed, and I believe that I'm actually closing them properly.
>
> My question is whether there is any way to figure out *why* zmq_ctx_term() waits indefinitely. Is there a way to see what exactly zmq_ctx_term() is waiting for?
>
> Thanks,
>
> Michi.
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
More information about the zeromq-dev
mailing list