[zeromq-dev] term() would not terminate

Martin Sustrik sustrik at 250bpm.com
Mon May 30 08:02:57 CEST 2011

Hi Pavel,

> How complicated would be to implement "debug" version of term which
> will after some timeout dump reason that block it? To stderr for
> example. As there are so many assertions in code there and there,
> this would seem to me logic?

So far there's no debug output from the library (aside of the error 
report when it crashes hard). If people believe there should be some 
debug tracing built-in, let's discuss it. The main question is such case 
is what exactly should be logged.

Also note that there's "sys://log" endpoint you can connect to and 
receive messages from that can be used for logging instead of console. 
The problem in this case is that during the shutdown even sys://log has 
to be terminated at some point, so there's no way too log everything up 
to the very end.

> I generally assume it is a good thing to require clean  up all thread
> before exit, but I take it frustrating that there is no way to see
> what is the reason for it (dumping socket ids that block the term
> will help to find the leak much faster). It just consumes the time to
> find out, whereas stderr debug will make it much faster to diagnose
> the reason.
> And thanks for linger idea. I would also assume that linger(0) seems
> to me more logic default than linger(-1) but I am sure there is
> reason behind it...

It's how TCP sockets behave. You want message to be sent in the 
following example, rather than being dropped silently:

zmq_send (s, msg, 0);
zmq_close (s);
zmq_term (ctx);
exit (0);


More information about the zeromq-dev mailing list