[zeromq-dev] zsock test hangs in pyczmq

Pieter Hintjens ph at imatix.com
Fri Jun 13 09:31:27 CEST 2014

It sounds like there's another socket being created somewhere, outside
of CZMQ's control, and this is causing the termination to block.

Or, something weird with threads. Can you try adding tracing to each
socket creation and destruction, in zsys (zmq_socket/zmq_destroy)?

On Fri, Jun 13, 2014 at 4:41 AM, Michel Pelletier
<pelletier.michel at gmail.com> wrote:
> I'm working on adding zsock and zactor support to pyczmq, and I have most of
> the work done, but my test for zsock is hanging.  The test runs and works,
> zsock_destroy is called correctly (not that it would matter the default
> linger is 0) but the process never exits.  gdb says it hanging on poll in
> zsys's s_terminate_process:
> #0  0x00007ffff78e2f7d in poll () at ../sysdeps/unix/syscall-template.S:81
> #1  0x00007ffff5361caa in poll (__timeout=-1, __nfds=1,
> __fds=0x7fffffffdd10) at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
> #2  zmq::signaler_t::wait (this=this at entry=0x9e7dc8,
> timeout_=timeout_ at entry=-1) at signaler.cpp:158
> #3  0x00007ffff5350177 in zmq::mailbox_t::recv (this=this at entry=0x9e7d68,
> cmd_=cmd_ at entry=0x7fffffffdd70, timeout_=timeout_ at entry=-1) at
> mailbox.cpp:72
> #4  0x00007ffff533fc0c in zmq::ctx_t::terminate (this=0x9e7cd0) at
> ctx.cpp:141
> #5  0x00007ffff5378921 in zmq_ctx_term (ctx_=<optimized out>) at zmq.cpp:157
> #6  0x00007ffff5816891 in s_terminate_process () at zsys.c:273
> #7  0x00007ffff7831071 in __run_exit_handlers (status=0,
> listp=0x7ffff7bb66a8 <__exit_funcs>,
> run_list_atexit=run_list_atexit at entry=true) at exit.c:77
> #8  0x00007ffff78310f5 in __GI_exit (status=<optimized out>) at exit.c:99
> #9  0x00007ffff7816dec in __libc_start_main (main=0x46a2a1 <main>, argc=2,
> ubp_av=0x7fffffffdf18, init=<optimized out>, fini=<optimized out>,
>     rtld_fini=<optimized out>, stack_end=0x7fffffffdf08) at libc-start.c:294
> #10 0x00000000005735fe in _start ()
> A little more digging looks like libzmq is waiting for a message from a
> 'reaper' thread that never arrives, context termination waits for this
> message with a timeout of -1 so it never exits.
> Anyone have any thoughts on this?  I don't know much about the
> reaper/shutdown side of things.
> -Michel
> _______________________________________________
> 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