[zeromq-dev] term() would not terminate

Pieter Hintjens ph at imatix.com
Sun May 29 21:17:28 CEST 2011


You have my sympathies, the blocking zmq_term() behaviour can be
really frustrating.

Here is how to make it work (in your main thread):

- set LINGER on every socket to zero, before closing
- close every socket
- call zmq_term

And in other threads:

- treat any error from a blocking recv() or send() or poll() as a
reason to exit the thread
- set LINGER on every socket to zero
- close every socket
- call zmq_term

You can do these steps manually in your app, or you can make some
abstraction around socket opening and termination that does it
automatically for you.


On Sun, May 29, 2011 at 10:31 AM, Pavel Chlupáček <chlupacek at gmail.com> wrote:
> Hi,
>        I am just in middle of development on 0mq server app in java/scala. I have touched couple of issues when not closing the sockets and having term() to hang. However at this moment I put in code many assertions and I am quite certain all sockets are closed before term() is called.
>    Does anyone have idea what can prevent term from terminating except unclosed sockets. Are there any other preconditions to be met for term() to terminate? Is there any way to inspect reason for term() to block?
> Thanks for help, I really like the tool, but this is driving me crazy :-)
> Pavel.
> _______________________________________________
> 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