[zeromq-dev] zmq_ctx_term blocks in my test

Laurent Alebarde l.alebarde at free.fr
Tue Jan 28 15:20:41 CET 2014


Hi Devs,

I am working on a test derived from /test_proxy.cpp/ with the use 
of/zmq_proxy_steerable/. After having sent TERMINATE to the control 
socket, the clients, the workers and the server task threads disapear as 
expected, but I have still three threads including main.

When it comes to:

*rc = zmq_ctx_term (ctx);*

It blocks. I assume it is waiting for the two other threads to terminate.

Inside *int zmq::ctx_t::terminate ()*, after the loop that stops the 
sockets: *sockets [i]->stop ();*, the condition in: *if (sockets.empty 
())* is *false*.  Shouln't it be *true* ? It blocks when it comes to: 
*int rc = term_mailbox.recv (&cmd, -1);*

Are the two extra threads remaining concerned by these two sockets ?

Should I wait for something in the client/worker/server tasks, before 
closing the sockets ?

The code is here: 
https://github.com/lalebarde/libzmq/commit/64574fe5425b3b5c8ed725eed620e6106412f3e3
The failing test is: /tests/test_proxy_chain.cpp
/It comes along a modification of /src/proxy.cpp /to be able to chain 
proxies in the same thread. I will propose a pull request when the test 
passes. But tests/test_proxy.cpp passes, and the nature of the 
modification is not suspect.

Cheers,


Laurent
//
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140128/9851ba19/attachment.htm>


More information about the zeromq-dev mailing list