[zeromq-dev] JZMQ - Context.term hangs when PUSH/PULL happen on the same thread.

Pieter Hintjens ph at imatix.com
Thu Feb 7 09:15:30 CET 2013

This was a long discussion at the time. Socket shutdown is kind of
difficult given that sockets can migrate between threads. libzmq at
some points waits for handshaking that can never arrive.

The solution is to (a) always close sockets before terminating the
context, and (b) set linger to 0 on every socket at least before
closing it.

CZMQ for example tracks opened sockets per context and closes them
automatically when needed.


On Thu, Feb 7, 2013 at 3:21 AM, Trevor Bernard <trevor.bernard at gmail.com> wrote:
> Any one know why this hangs when you try to term the context.
> https://gist.github.com/trevorbernard/4727863
> But if I run the sockets on a different thread, the context terms fine.
> https://gist.github.com/trevorbernard/4727870
> I've seen a few mentions of this but I've yet to find a good explanation of why?
> -Trev
> _______________________________________________
> 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