[zeromq-dev] term() would not terminate

Pavel Chlupáček chlupacek at gmail.com
Mon May 30 07:14:00 CEST 2011


yeah I found it too. 

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?  

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...

P.

On May 29, 2011, at 9:17 PM, Pieter Hintjens wrote:

> Pavel,
> 
> 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.
> 
> -Pieter
> 
> 
> 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
>> 
>> 
> _______________________________________________
> 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