[zeromq-dev] zmq_ctx_term blocks in my test

Laurent Alebarde l.alebarde at free.fr
Tue Jan 28 15:37:36 CET 2014


I have added a 100 ms LINGER to all sockets, but it does not change 
anything.
https://github.com/lalebarde/libzmq/commit/e64498610ce8976b9cade226e415b7646a7d02b3

Le 28/01/2014 15:20, Laurent Alebarde a écrit :
> 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
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

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


More information about the zeromq-dev mailing list