[zeromq-dev] zmq_ctx_term hang

Pieter Hintjens ph at imatix.com
Tue Apr 1 15:24:23 CEST 2014


There's no way to see what's hanging. This is still a poorly built
part of libzmq.

The best way to debug this is to make a test case and strip that down
until it works.

On Tue, Apr 1, 2014 at 2:59 PM, 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